From 4afe24808ee253c44c65b855f65bd0749c1e1524 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 17 Feb 2010 19:03:30 +0800 Subject: egl: Revisit global data locking. Lock the global mutex in _eglPreloadDrivers and _eglAllocScreenHandle. Add comments to why certain pathes do not need locking. --- src/egl/main/eglscreen.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/egl/main/eglscreen.c') diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c index 97a405a4b4..c47afd6abd 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; } -- cgit v1.2.3