aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2020-08-20 14:44:51 -0700
committerArve Hjønnevåg <arve@android.com>2020-10-26 18:26:07 -0700
commit58830b44b718952aae8fec5d3fdf73c75437d97c (patch)
treeaece1d8ac719339fb12cbf2062674a8c3898ef58 /lib
parent4fc0f58fea2bd1de505a61261baedb0d0d252833 (diff)
downloadcommon-58830b44b718952aae8fec5d3fdf73c75437d97c.tar.gz
[lib][debug] Release thread-lock if panic is called with it held
Bug: 165823021 Change-Id: I5633e2009431289eeee3de46b01f008bd3d3e0ee
Diffstat (limited to 'lib')
-rw-r--r--lib/debug/debug.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/debug/debug.c b/lib/debug/debug.c
index 285844c9..084b6c2c 100644
--- a/lib/debug/debug.c
+++ b/lib/debug/debug.c
@@ -53,6 +53,10 @@ void _panic(const char *fmt, ...)
va_list ap;
struct thread *curr = get_current_thread();
+ if (thread_lock_held()) {
+ printf("panic called with thread lock held\n");
+ thread_unlock_ints_disabled();
+ }
dump_backtrace();
if (curr && thread_get_flag_exit_on_panic(curr)) {