egl/main: use c11/threads' mutex directly
[mesa.git] / src / egl / main / egldriver.c
index e6a61f3108b13792a1c301ad847c0ef113301e2a..6983af966b652ec12e1f40c857616fb772c9a534 100644 (file)
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "c11/threads.h"
 
 #include "eglstring.h"
 #include "egldefines.h"
 #include "egldisplay.h"
 #include "egldriver.h"
 #include "egllog.h"
-#include "eglmutex.h"
 
 #if defined(_EGL_OS_UNIX)
 #include <dlfcn.h>
@@ -63,7 +63,7 @@ typedef struct _egl_module {
    _EGLDriver *Driver;
 } _EGLModule;
 
-static _EGLMutex _eglModuleMutex = _EGL_MUTEX_INITIALIZER;
+static mtx_t _eglModuleMutex = _MTX_INITIALIZER_NP;
 static _EGLArray *_eglModules;
 
 const struct {
@@ -616,7 +616,7 @@ _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only)
 
    assert(!dpy->Initialized);
 
-   _eglLockMutex(&_eglModuleMutex);
+   mtx_lock(&_eglModuleMutex);
 
    /* set options */
    dpy->Options.TestOnly = test_only;
@@ -628,7 +628,7 @@ _eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only)
       best_drv = _eglMatchAndInitialize(dpy);
    }
 
-   _eglUnlockMutex(&_eglModuleMutex);
+   mtx_unlock(&_eglModuleMutex);
 
    if (best_drv) {
       _eglLog(_EGL_DEBUG, "the best driver is %s%s",