Skip to content
Snippets Groups Projects
Commit cb86f7d1 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: use QuitWhenIdle for thread-safety

In |MessageLoopThread::ShutDown|, we invoke |QuitWhenIdleClosure| that
is not thread-safe, but |ShutDown| is meant to be called from a
different thread than the owner of the |MessageLoopThread|.

In this CL, we change it to the thread-safe variant, |QuitWhenIdle|.

Bug: 263808792
Tag: #floss
Test: Build and verify it doesn't crash when dis/enabling BT
Change-Id: Id2b8f7537b82b25a5950b35ecd615a554b89670e
parent 712a1470
No related branches found
No related tags found
No related merge requests found
......@@ -141,12 +141,7 @@ void MessageLoopThread::ShutDown() {
CHECK_NE(thread_id_, base::PlatformThread::CurrentId())
<< __func__ << " should not be called on the thread itself. "
<< "Otherwise, deadlock may happen.";
if (!message_loop_->task_runner()->PostTask(
FROM_HERE, run_loop_->QuitWhenIdleClosure())) {
LOG(FATAL) << __func__
<< ": failed to post task to message loop for thread "
<< *this;
}
run_loop_->QuitWhenIdle();
}
thread_->join();
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment