summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglmutex.h
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2013-04-26 08:04:17 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-01-23 12:55:55 +0000
commitf298720cbcf311804e9f4479d27ad06e1b932007 (patch)
treea2e05068d102dcc7246fc2062b8eb249daa7b9cc /src/egl/main/eglmutex.h
parent54876afcf0624c1ef25c1995cfc3b10fbfab1ba0 (diff)
downloadexternal_mesa3d-f298720cbcf311804e9f4479d27ad06e1b932007.zip
external_mesa3d-f298720cbcf311804e9f4479d27ad06e1b932007.tar.gz
external_mesa3d-f298720cbcf311804e9f4479d27ad06e1b932007.tar.bz2
egl: Use C11 thread abstractions.
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src/egl/main/eglmutex.h')
-rw-r--r--src/egl/main/eglmutex.h26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/egl/main/eglmutex.h b/src/egl/main/eglmutex.h
index 1349e9e..2ec965c 100644
--- a/src/egl/main/eglmutex.h
+++ b/src/egl/main/eglmutex.h
@@ -31,46 +31,34 @@
#include "eglcompiler.h"
-#ifdef HAVE_PTHREAD
-#include <pthread.h>
+#include "c11/threads.h"
-typedef pthread_mutex_t _EGLMutex;
+typedef mtx_t _EGLMutex;
static INLINE void _eglInitMutex(_EGLMutex *m)
{
- pthread_mutex_init(m, NULL);
+ mtx_init(m, mtx_plain);
}
static INLINE void
_eglDestroyMutex(_EGLMutex *m)
{
- pthread_mutex_destroy(m);
+ mtx_destroy(m);
}
static INLINE void
_eglLockMutex(_EGLMutex *m)
{
- pthread_mutex_lock(m);
+ mtx_lock(m);
}
static INLINE void
_eglUnlockMutex(_EGLMutex *m)
{
- pthread_mutex_unlock(m);
+ mtx_unlock(m);
}
-#define _EGL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _EGL_MUTEX_INITIALIZER _MTX_INITIALIZER_NP
-#else
-
-typedef int _EGLMutex;
-static INLINE void _eglInitMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglDestroyMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglLockMutex(_EGLMutex *m) { (void) m; }
-static INLINE void _eglUnlockMutex(_EGLMutex *m) { (void) m; }
-
-#define _EGL_MUTEX_INITIALIZER 0
-
-#endif
#endif /* EGLMUTEX_INCLUDED */