summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-02-17 19:03:30 +0800
committerChia-I Wu <[email protected]>2010-02-17 20:00:12 +0800
commit4afe24808ee253c44c65b855f65bd0749c1e1524 (patch)
treee7ec43369a44966988dac08c9356b4a2b4e9c76f /src/egl/main/eglscreen.c
parent655f4654675e601a9482e40d8e50156c965b8934 (diff)
egl: Revisit global data locking.
Lock the global mutex in _eglPreloadDrivers and _eglAllocScreenHandle. Add comments to why certain pathes do not need locking.
Diffstat (limited to 'src/egl/main/eglscreen.c')
-rw-r--r--src/egl/main/eglscreen.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 97a405a4b4b..c47afd6abda 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -22,17 +22,22 @@
#include "eglconfig.h"
#include "eglsurface.h"
#include "eglscreen.h"
+#include "eglmutex.h"
/**
* Return a new screen handle/ID.
* NOTE: we never reuse these!
*/
-EGLScreenMESA
+static EGLScreenMESA
_eglAllocScreenHandle(void)
{
- EGLScreenMESA s = _eglGlobal.FreeScreenHandle;
- _eglGlobal.FreeScreenHandle++;
+ EGLScreenMESA s;
+
+ _eglLockMutex(_eglGlobal.Mutex);
+ s = _eglGlobal.FreeScreenHandle++;
+ _eglUnlockMutex(_eglGlobal.Mutex);
+
return s;
}