[android] Fix issue when stop is called before run on the RunLoop
The current ::stop() implementation was not thread safe and we should queue the ::stop() for the next loop iteration so even if we call ::stop() before ::run(), it gets processed.
This commit is contained in:
@@ -211,8 +211,10 @@ void RunLoop::runOnce() {
|
||||
}
|
||||
|
||||
void RunLoop::stop() {
|
||||
impl->running = false;
|
||||
impl->wake();
|
||||
invoke([&] {
|
||||
impl->running = false;
|
||||
impl->wake();
|
||||
});
|
||||
}
|
||||
|
||||
void RunLoop::addWatch(int, Event, std::function<void(int, Event)>&&) {
|
||||
|
||||
Reference in New Issue
Block a user