DescriptionMake RunLoop::Quit() thread-safe.
It was already safe to call it off-sequence as of r472835.
But making it thread-safe is key to enabling use cases like:
RunLoop run_loop_;
<post a task binding run_loop_.QuitClosure() to task scheduler>
run_loop_.Run();
e.g. happens in https://codereview.chromium.org/2881143002/ without this CL
Run() and Quit() are racing in this situation as the posted task may run
at any point after being posted. FYI, RunLoop() already supports being Quit()
prior to being Run() so the race resolving either way is fine, it just needs
to be thread-safe.
BUG=722537
Review-Url: https://codereview.chromium.org/2892993002
Cr-Commit-Position: refs/heads/master@{#473378}
Committed: https://chromium.googlesource.com/chromium/src/+/cf5e4ce0c0eff930821b2459ee03d161ab4d6550
Patch Set 1 #
Total comments: 4
Patch Set 2 : add tests that call Quit(WhenIdle) directly, without the Quit(WhenIdle)Closure #
Messages
Total messages: 15 (8 generated)
|