Exemplo n.º 1
0
static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
{
   if (!_egl_FreeTSD && dtor) {
      _egl_FreeTSD = dtor;
      _eglAddAtExitCall(_eglFiniTSD);
   }
   return EGL_TRUE;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}