Commit 2cb5f7f5 authored by Wei Li's avatar Wei Li Committed by Jinguang Dong
Browse files

Move static variable out of should_trace().



Static variable initialization calls pthread_mutex_lock() and may lead to
deadlock if should_trace() is called in pthread_mutex_lock context.

Here is a stack of blocked init process:
__cxa_guard_acquire ->
should_trace        ->
bionic_trace_begin  ->
__pthread_mutex_lock_with_timeout ->
__cxa_guard_release ->
should_trace        ->
bionic_trace_begin  ->
__pthread_mutex_lock_with_timeout ->
mutex::lock        ->
LogMessage::~LogMessage
......
So we need to move it out

Test: 1 Compiled and booted.
      2 Reboot pressure test for more than 30000 times.

Change-Id: I8d97745161f1aa8942b63338208ea74830768ae1
Signed-off-by: default avatarWei Li <sirius.liwei@huawei.com>
Signed-off-by: default avatarJinguang Dong <dongjinguang@huawei.com>
parent 40517761
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment