diff options
author | Jack He <siyuanh@google.com> | 2018-02-07 17:33:16 -0800 |
---|---|---|
committer | Jack He <siyuanh@google.com> | 2018-02-09 02:43:58 -0800 |
commit | abc34b4d74d0108f526d87f486d0e18813e1ae0a (patch) | |
tree | 26ca1db3a436f0f9e0f8b1e9ccaffff348f37262 /udrv | |
parent | 884314c1d966f80557b7b1c56918f110de3ad22c (diff) | |
download | bt-abc34b4d74d0108f526d87f486d0e18813e1ae0a.tar.gz |
A2DP: Construct BtWorkerThread's message loop on designated thread
* Moves BtWorkerThread's message_loop_'s construction to the
Run() method run by the designated message_loop_thread_ so that
message_loop_'s construction and execution are on the same thread
* Makes BtWorkerThread::StartUp() blocking until message_loop_
starts running using std:condition_variable
* Modify BtWorkerThread::DoInThread() to return boolean
Detail:
Before this CL, BtWorkerThread.message_loop_ is created on Java main
thread and run on message_loop_thread_. During clean-up, A2DP shutdown
message_loop_thread_, rendering the posted_from field in current_pending_task_
invalid. However, although the runner thread is killed, the owner
thread, the Java main thread, is still active. Therefore, we we try to
PostTask() from Java main thread after message_loop_thread_ is killed,
we will try to access an invalid Location object. This results in a
SEGV_MAPPER SEGFAULT. Thus, the fix would be creating and running the
message loop on the same thread so that Java main thread won't have an
invalid message loop after the worker thread is killed.
This can be detected earlier through adding "-DDCHECK_ALWAYS_ON" in both
libchrome and libbluetooth and libchrome will validate the thread for
us.
Fixes: 72831931
Test: Test with DCHECK_ALWAYS_ON in both libbluetooth and libchrome
ProfileServiceTest stress tests
Change-Id: I7b196b8c1113c2758c2b82ddf4d13c46352bb620
Diffstat (limited to 'udrv')
0 files changed, 0 insertions, 0 deletions