util/u_debug: Use 'initialized' instead of 'first'
Using 'initialized' to guard the one-time init, means it can be set to false as part of .bss instead setting 'first' to true in .data. This is more efficient and works at .ctor time. Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16952>
This commit is contained in:
committed by
Marge Bot
parent
1f323437df
commit
279f32e042
@@ -301,11 +301,11 @@ static mtx_t backtrace_mutex;
|
||||
static void
|
||||
initialize_backtrace_mutex()
|
||||
{
|
||||
static bool first = true;
|
||||
static bool initialized = false;
|
||||
|
||||
if (first) {
|
||||
if (!initialized) {
|
||||
(void)mtx_init(&backtrace_mutex, mtx_plain);
|
||||
first = false;
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user