mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 15:38:09 +02:00
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 <ian.d.romanick@intel.com> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
parent
99939982ec
commit
fc2feea685
1 changed files with 4 additions and 0 deletions
|
|
@ -240,6 +240,10 @@ _glapi_check_multithread(void)
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ThreadCheckMutex);
|
_glthread_LOCK_MUTEX(ThreadCheckMutex);
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
|
/* initialize TSDs */
|
||||||
|
(void) _glthread_GetTSD(&ContextTSD);
|
||||||
|
(void) _glthread_GetTSD(&_gl_DispatchTSD);
|
||||||
|
|
||||||
knownID = _glthread_GetID();
|
knownID = _glthread_GetID();
|
||||||
firstCall = GL_FALSE;
|
firstCall = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue