Commit 88f55059 authored by Peter Jankuliak's avatar Peter Jankuliak
Browse files

WatchDog: remove coro stack size optimization

It was causing crashes on Android
parent 79793f02
......@@ -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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment