diff options
author | Emil Velikov <[email protected]> | 2015-03-05 15:07:51 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-03-06 16:46:17 +0000 |
commit | 6cee785c69a5c8d2d32b6807f9c502117f5a74b0 (patch) | |
tree | 1359974cc2d2e3dd0da4ec7898f1f153bc3557d6 /src/egl/main/eglcurrent.c | |
parent | bfb4db83b618d57fcc5f0c9e9fdb3a7ff33d07f3 (diff) |
egl/main: use c11/threads' mutex directly
Remove the inline wrappers/abstraction layer.
Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/main/eglcurrent.c')
-rw-r--r-- | src/egl/main/eglcurrent.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 3d496411cbb..dc32ed4c210 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -31,7 +31,6 @@ #include "c99_compat.h" #include "egllog.h" -#include "eglmutex.h" #include "eglcurrent.h" #include "eglglobals.h" @@ -47,7 +46,7 @@ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; #if HAVE_PTHREAD #include <pthread.h> -static _EGLMutex _egl_TSDMutex = _EGL_MUTEX_INITIALIZER; +static mtx_t _egl_TSDMutex = _MTX_INITIALIZER_NP; static EGLBoolean _egl_TSDInitialized; static pthread_key_t _egl_TSD; static void (*_egl_FreeTSD)(_EGLThreadInfo *); @@ -76,7 +75,7 @@ static inline _EGLThreadInfo *_eglGetTSD(void) static inline void _eglFiniTSD(void) { - _eglLockMutex(&_egl_TSDMutex); + mtx_lock(&_egl_TSDMutex); if (_egl_TSDInitialized) { _EGLThreadInfo *t = _eglGetTSD(); @@ -85,18 +84,18 @@ static inline void _eglFiniTSD(void) _egl_FreeTSD((void *) t); pthread_key_delete(_egl_TSD); } - _eglUnlockMutex(&_egl_TSDMutex); + mtx_unlock(&_egl_TSDMutex); } static inline EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) { if (!_egl_TSDInitialized) { - _eglLockMutex(&_egl_TSDMutex); + mtx_lock(&_egl_TSDMutex); /* check again after acquiring lock */ if (!_egl_TSDInitialized) { if (pthread_key_create(&_egl_TSD, (void (*)(void *)) dtor) != 0) { - _eglUnlockMutex(&_egl_TSDMutex); + mtx_unlock(&_egl_TSDMutex); return EGL_FALSE; } _egl_FreeTSD = dtor; @@ -104,7 +103,7 @@ static inline EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) _egl_TSDInitialized = EGL_TRUE; } - _eglUnlockMutex(&_egl_TSDMutex); + mtx_unlock(&_egl_TSDMutex); } return EGL_TRUE; |