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@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
#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 *);
_EGLDriver *Driver;
} _EGLModule;
-static _EGL_DECLARE_MUTEX(_eglModuleMutex);
+static _EGLMutex _eglModuleMutex = _EGL_MUTEX_INITIALIZER;
static _EGLArray *_eglModules;
const struct {
#include "eglmutex.h"
-static _EGL_DECLARE_MUTEX(_eglGlobalMutex);
+static _EGLMutex _eglGlobalMutex = _EGL_MUTEX_INITIALIZER;
+
struct _egl_global _eglGlobal =
{
&_eglGlobalMutex, /* Mutex */
}
#define _EGL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#define _EGL_DECLARE_MUTEX(m) \
- _EGLMutex m = _EGL_MUTEX_INITIALIZER
#else
static INLINE void _eglUnlockMutex(_EGLMutex *m) { (void) m; }
#define _EGL_MUTEX_INITIALIZER 0
-#define _EGL_DECLARE_MUTEX(m) \
- _EGLMutex m = _EGL_MUTEX_INITIALIZER
#endif
/* ugh, no atomic op? */
-static _EGL_DECLARE_MUTEX(_eglNextScreenHandleMutex);
+static _EGLMutex _eglNextScreenHandleMutex = _EGL_MUTEX_INITIALIZER;
static EGLScreenMESA _eglNextScreenHandle = 1;