Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
88f55059
Commit
88f55059
authored
Mar 26, 2020
by
Peter Jankuliak
Browse files
WatchDog: remove coro stack size optimization
It was causing crashes on Android
parent
79793f02
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util/watch_dog.h
View file @
88f55059
...
...
@@ -95,31 +95,6 @@ public:
void
start
(
const
asio
::
executor
&
ex
,
Duration
d
,
OnTimeout
on_timeout
)
{
stop
();
// This is defined in boost/libs/coroutine/src/{posix,windows}/stack_traits.cpp
// It seems to be defined to an arbitrary number 8*1024. I.e. it
// doesn't seem to be derived from sizes of some internal structures of
// the coroutine library.
size_t
min_coro_size
=
boost
::
coroutines
::
stack_traits
::
minimum_size
();
// XXX This is ugly, but given how often WatchDog is used, we do want to
// make the stack allocation small. Posslibly best approach would be to
// convert this whole class to use stackless coroutines in the future.
const
size_t
required_stack_size
=
(
sizeof
(
this
)
+
sizeof
(
ex
)
+
sizeof
(
d
)
+
sizeof
(
asio
::
yield_context
)
+
sizeof
(
HandlerTracker
)
+
sizeof
(
State
)
+
(
sizeof
(
void
*
)
*
2
)
// ? Defer
+
sizeof
(
Clock
::
now
())
+
sizeof
(
sys
::
error_code
)
)
*
2
// To account for temporaries
+
sizeof
(
on_timeout
);
boost
::
coroutines
::
attributes
attribs
;
attribs
.
size
=
min_coro_size
+
required_stack_size
;
asio
::
spawn
(
ex
,
[
self_
=
this
,
ex
,
d
,
on_timeout
=
std
::
move
(
on_timeout
)]
(
asio
::
yield_context
yield
)
mutable
{
TRACK_HANDLER
();
...
...
@@ -143,7 +118,7 @@ public:
}
on_timeout
();
}
,
attribs
);
});
}
Clock
::
duration
stop
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment