[android] Fix possibly race on undefined behavior

`runnable->iter = runnables.end()` assumes that `::end()` is a
`static` or `constxpr` and thread-safe. This is likely to be true
for most of the implementations. That said we cannot rely on
undefined behavior and we should assume the worse case scenario.
This commit is contained in:
Thiago Marcos P. Santos
2018-07-17 14:20:08 +03:00
committed by Konstantin Käfer
parent 93d37282d9
commit bffc60fefd

View File

@@ -167,6 +167,7 @@ void RunLoop::Impl::removeRunnable(Runnable* runnable) {
}
void RunLoop::Impl::initRunnable(Runnable* runnable) {
std::lock_guard<std::recursive_mutex> lock(mtx);
runnable->iter = runnables.end();
}