static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) { if (!_egl_FreeTSD && dtor) { _egl_FreeTSD = dtor; _eglAddAtExitCall(_eglFiniTSD); } return EGL_TRUE; }
static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) { if (!_egl_TSDInitialized) { _eglLockMutex(&_egl_TSDMutex); /* check again after acquiring lock */ if (!_egl_TSDInitialized) { if (pthread_key_create(&_egl_TSD, (void (*)(void *)) dtor) != 0) { _eglUnlockMutex(&_egl_TSDMutex); return EGL_FALSE; } _egl_FreeTSD = dtor; _eglAddAtExitCall(_eglFiniTSD); _egl_TSDInitialized = EGL_TRUE; } _eglUnlockMutex(&_egl_TSDMutex); } return EGL_TRUE; }
static inline EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) { if (!_egl_TSDInitialized) { mtx_lock(&_egl_TSDMutex); /* check again after acquiring lock */ if (!_egl_TSDInitialized) { if (tss_create(&_egl_TSD, (void (*)(void *)) dtor) != thrd_success) { mtx_unlock(&_egl_TSDMutex); return EGL_FALSE; } _egl_FreeTSD = dtor; _eglAddAtExitCall(_eglFiniTSD); _egl_TSDInitialized = EGL_TRUE; } mtx_unlock(&_egl_TSDMutex); } return EGL_TRUE; }