Module: Mesa Branch: master Commit: fc2feea685d86c520fb01199caa5a46eae20c7aa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc2feea685d86c520fb01199caa5a46eae20c7aa
Author: Chia-I Wu <[email protected]> Date: Fri Jul 10 17:35:11 2009 +0800 glapi: Fix a race in accessing context/dispatch TSD. If multiple threads set/get a TSD at roughly same time for the first time, glthread might (wrongly) initialize it more than once. This patch solves the race by initializing context/dispatch TSDs early. Acked-by: Ian Romanick <[email protected]> Signed-off-by: Chia-I Wu <[email protected]> --- src/mesa/glapi/glapi.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 30aec20..b9ab9c0 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -240,6 +240,10 @@ _glapi_check_multithread(void) _glthread_LOCK_MUTEX(ThreadCheckMutex); if (firstCall) { + /* initialize TSDs */ + (void) _glthread_GetTSD(&ContextTSD); + (void) _glthread_GetTSD(&_gl_DispatchTSD); + knownID = _glthread_GetID(); firstCall = GL_FALSE; } _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
