From 37d79e38e96acd840bf6e839866493cc9b361c49 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Tue, 6 Sep 2022 23:06:14 +0800 Subject: [PATCH] egl: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in egllog.c Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Acked-by: David Heidelberg Part-of: --- src/egl/main/egllog.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 8d8273272c7..655e139f4af 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -41,6 +41,7 @@ #include #include "c11/threads.h" #include "util/macros.h" +#include "util/simple_mtx.h" #include "util/u_string.h" #include "egllog.h" @@ -60,12 +61,12 @@ static struct { - mtx_t mutex; + simple_mtx_t mutex; EGLBoolean initialized; EGLint level; } logging = { - .mutex = _MTX_INITIALIZER_NP, + .mutex = SIMPLE_MTX_INITIALIZER, .initialized = EGL_FALSE, .level = FALLBACK_LOG_LEVEL, }; @@ -160,7 +161,7 @@ _eglLog(EGLint level, const char *fmtStr, ...) if (level > logging.level || level < 0) return; - mtx_lock(&logging.mutex); + simple_mtx_lock(&logging.mutex); va_start(args, fmtStr); ret = vsnprintf(msg, MAXSTRING, fmtStr, args); @@ -170,7 +171,7 @@ _eglLog(EGLint level, const char *fmtStr, ...) _eglDefaultLogger(level, msg); - mtx_unlock(&logging.mutex); + simple_mtx_unlock(&logging.mutex); if (level == _EGL_FATAL) exit(1); /* or abort()? */