From 4d5db38cc386f109d21856ecc31722a952e6d2ee Mon Sep 17 00:00:00 2001 From: rleix Date: Fri, 1 Dec 2017 15:25:46 +0800 Subject: Fix the system_error while calling thread::join() in NativeCallbackThread. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit system_server crashed because the system_error "resource_deadlock_would_occur" occurred while calling thread::join(). It is caused by the value of thread is same with the calling thread. Correct it using std::this_thread::get_id() to check whether it is the same thread with the calling thread. Bug: 70603039 Test step: Step 1 : Flash DUT and boot it. Step 2 : Connect with PC via USB. Step 3 : Run the following adb command and check the DUT:  adb shell su ps -A | grep broadcastradio kill xxx(the process id of android.hardware.broadcastradio@intel-service) Change-Id: Ia21282c4cc631a0788496081b1821be28929fae6 Signed-off-by: Lei,RayX --- services/core/jni/BroadcastRadio/NativeCallbackThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/jni/BroadcastRadio/NativeCallbackThread.cpp b/services/core/jni/BroadcastRadio/NativeCallbackThread.cpp index 81d46f39d84a..777d344e7a09 100644 --- a/services/core/jni/BroadcastRadio/NativeCallbackThread.cpp +++ b/services/core/jni/BroadcastRadio/NativeCallbackThread.cpp @@ -106,7 +106,7 @@ void NativeCallbackThread::stop() { mQueueCond.notify_one(); } - if (mThread.get_id() == std::thread::id()) { + if (mThread.get_id() == std::this_thread::get_id()) { // you can't self-join a thread, but it's ok when calling from our sub-task ALOGD("About to stop native callback thread %p", this); mThread.detach(); -- cgit v1.2.3-59-g8ed1b