summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
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;
}