mapi: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in stub.c

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 23:00:34 +08:00 committed by Marge Bot
parent 1411d79e24
commit ccf6dfedbc

View file

@ -31,6 +31,7 @@
#include "c11/threads.h"
#include "util/macros.h"
#include "util/simple_mtx.h"
#include "u_current.h"
#include "entry.h"
#include "stub.h"
@ -118,11 +119,11 @@ stub_add_dynamic(const char *name)
struct mapi_stub *
stub_find_dynamic(const char *name, int generate)
{
static mtx_t dynamic_mutex = _MTX_INITIALIZER_NP;
static simple_mtx_t dynamic_mutex = SIMPLE_MTX_INITIALIZER;
struct mapi_stub *stub = NULL;
int count, i;
mtx_lock(&dynamic_mutex);
simple_mtx_lock(&dynamic_mutex);
if (generate)
assert(!stub_find_public(name));
@ -139,7 +140,7 @@ stub_find_dynamic(const char *name, int generate)
if (generate && !stub)
stub = stub_add_dynamic(name);
mtx_unlock(&dynamic_mutex);
simple_mtx_unlock(&dynamic_mutex);
return stub;
}