util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in u_debug_stack_android.cpp

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
This commit is contained in:
Yonggang Luo 2022-09-06 22:09:29 +08:00 committed by Marge Bot
parent a26d5b4b69
commit 44901ebd97

View file

@ -23,13 +23,14 @@
#include <backtrace/Backtrace.h>
#include "util/simple_mtx.h"
#include "util/u_debug.h"
#include "u_debug_stack.h"
#include "util/hash_table.h"
#include "os/os_thread.h"
static hash_table *symbol_table;
static mtx_t table_mutex = _MTX_INITIALIZER_NP;
static simple_mtx_t table_mutex = SIMPLE_MTX_INITIALIZER;
static const char *
intern_symbol(const char *symbol)
@ -67,7 +68,7 @@ debug_backtrace_capture(debug_stack_frame *backtrace,
/* Add one to exclude this call. Unwind already ignores itself. */
bt->Unwind(start_frame + 1);
mtx_lock(&table_mutex);
simple_mtx_lock(&table_mutex);
for (unsigned i = 0; i < nr_frames; i++) {
const backtrace_frame_data_t* frame = bt->GetFrame(i);
@ -82,7 +83,7 @@ debug_backtrace_capture(debug_stack_frame *backtrace,
}
}
mtx_unlock(&table_mutex);
simple_mtx_unlock(&table_mutex);
delete bt;
}