Mesa (master): egl: Kill macro _EGL_DECLARE_MUTEX
Chad Versace
chadversary at kemper.freedesktop.org
Tue Nov 26 20:52:04 UTC 2013
Module: Mesa
Branch: master
Commit: 97851145bc74f4bda93dff4e6bb3cbc4789ab23a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=97851145bc74f4bda93dff4e6bb3cbc4789ab23a
Author: Chad Versace <chad.versace at linux.intel.com>
Date: Fri Oct 11 12:50:21 2013 -0700
egl: Kill macro _EGL_DECLARE_MUTEX
Replace all occurences of the macro with its expansion.
It seems that the macro intended to provide cross-platform static mutex
intialization. However, it had the same definition in all pre-processor
paths:
#define _EGL_DECLARE_MUTEX(m) _EGLMutex m = _EGL_MUTEX_INITIALIZER
Therefore this abstraction obscured rather than helped.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/egl/main/eglcurrent.c | 2 +-
src/egl/main/egldriver.c | 2 +-
src/egl/main/eglglobals.c | 3 ++-
src/egl/main/eglmutex.h | 4 ----
src/egl/main/eglscreen.c | 2 +-
5 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index 5b09a480..fcb732d 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -45,7 +45,7 @@ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#if HAVE_PTHREAD
#include <pthread.h>
-static _EGL_DECLARE_MUTEX(_egl_TSDMutex);
+static _EGLMutex _egl_TSDMutex = _EGL_MUTEX_INITIALIZER;
static EGLBoolean _egl_TSDInitialized;
static pthread_key_t _egl_TSD;
static void (*_egl_FreeTSD)(_EGLThreadInfo *);
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index ffdd146..6b6792a 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -60,7 +60,7 @@ typedef struct _egl_module {
_EGLDriver *Driver;
} _EGLModule;
-static _EGL_DECLARE_MUTEX(_eglModuleMutex);
+static _EGLMutex _eglModuleMutex = _EGL_MUTEX_INITIALIZER;
static _EGLArray *_eglModules;
const struct {
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 5c2fddf..cc06268 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -36,7 +36,8 @@
#include "eglmutex.h"
-static _EGL_DECLARE_MUTEX(_eglGlobalMutex);
+static _EGLMutex _eglGlobalMutex = _EGL_MUTEX_INITIALIZER;
+
struct _egl_global _eglGlobal =
{
&_eglGlobalMutex, /* Mutex */
diff --git a/src/egl/main/eglmutex.h b/src/egl/main/eglmutex.h
index e464864..1349e9e 100644
--- a/src/egl/main/eglmutex.h
+++ b/src/egl/main/eglmutex.h
@@ -60,8 +60,6 @@ _eglUnlockMutex(_EGLMutex *m)
}
#define _EGL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#define _EGL_DECLARE_MUTEX(m) \
- _EGLMutex m = _EGL_MUTEX_INITIALIZER
#else
@@ -72,8 +70,6 @@ static INLINE void _eglLockMutex(_EGLMutex *m) { (void) m; }
static INLINE void _eglUnlockMutex(_EGLMutex *m) { (void) m; }
#define _EGL_MUTEX_INITIALIZER 0
-#define _EGL_DECLARE_MUTEX(m) \
- _EGLMutex m = _EGL_MUTEX_INITIALIZER
#endif
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 21e2450..46cfebb 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -57,7 +57,7 @@
/* ugh, no atomic op? */
-static _EGL_DECLARE_MUTEX(_eglNextScreenHandleMutex);
+static _EGLMutex _eglNextScreenHandleMutex = _EGL_MUTEX_INITIALIZER;
static EGLScreenMESA _eglNextScreenHandle = 1;
More information about the mesa-commit
mailing list