[MessageLoop] Lock-free ScheduleWork() scheme
The Lock is causing hangs because of priority inversion mixed with priority boosting (ScheduleWork() tends to boost the destination thread which may deschedule the posting thread; if the posting thread is a background thread this boost-induded-desched-while-holding-lock can cause a livelock). See https://crbug.com/890978#c10 for example crashes catching this. The Lock was only necessary for startup/shutdown and is being replaced by a lock-free atomic scheme in this CL. MessagePump::ScheduleWork() itself was already thread-safe (but the Android impl did unnecessarily check a non-atomic bool) This adds a WaitableEvent in ~MessageLoop(); hence the requirement for a wait-allowance in net's EmbeddedTestServer. TBR=zhongyi@chromium.org (embedded_test_server.cc side-effects) Bug: 890978, 874237 Change-Id: I0916e5a99035a935b0a23a770af256f334e78c43 Reviewed-on: https://chromium-review.googlesource.com/c/1278631 Commit-Queue: Gabriel Charette <gab@chromium.org> Reviewed-by:François Doray <fdoray@chromium.org> Cr-Commit-Position: refs/heads/master@{#601600}
Showing
This diff is collapsed.
Please register or sign in to comment