diff options
author | Eric Engestrom <[email protected]> | 2019-04-12 17:47:59 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-05-02 14:44:16 +0000 |
commit | a34ee4dec780e01fb33780893da0cb95af2beb13 (patch) | |
tree | 205140bf5d2d5f00cb949123b0d4ab73a6da15cb /src/egl | |
parent | 6ec4ed48fc2056d3475e5e60de7c34fe42f8fd33 (diff) |
egl: hard-code destroy function instead of passing it around as a pointer
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/main/eglcurrent.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 479f231fb8f..2e7d164bce1 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -42,7 +42,7 @@ static _EGLThreadInfo dummy_thread; static mtx_t _egl_TSDMutex = _MTX_INITIALIZER_NP; static EGLBoolean _egl_TSDInitialized; static tss_t _egl_TSD; -static void (*_egl_FreeTSD)(_EGLThreadInfo *); +static void _eglDestroyThreadInfo(_EGLThreadInfo *t); #ifdef GLX_USE_TLS static __thread const _EGLThreadInfo *_egl_TLS @@ -73,25 +73,23 @@ static inline void _eglFiniTSD(void) _EGLThreadInfo *t = _eglGetTSD(); _egl_TSDInitialized = EGL_FALSE; - if (t && _egl_FreeTSD) - _egl_FreeTSD((void *) t); + _eglDestroyThreadInfo(t); tss_delete(_egl_TSD); } mtx_unlock(&_egl_TSDMutex); } -static inline EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) +static inline EGLBoolean _eglInitTSD() { 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) { + if (tss_create(&_egl_TSD, (void (*)(void *)) _eglDestroyThreadInfo) != thrd_success) { mtx_unlock(&_egl_TSDMutex); return EGL_FALSE; } - _egl_FreeTSD = dtor; _eglAddAtExitCall(_eglFiniTSD); _egl_TSDInitialized = EGL_TRUE; } @@ -143,7 +141,7 @@ _eglDestroyThreadInfo(_EGLThreadInfo *t) static inline _EGLThreadInfo * _eglCheckedGetTSD(void) { - if (_eglInitTSD(&_eglDestroyThreadInfo) != EGL_TRUE) { + if (_eglInitTSD() != EGL_TRUE) { _eglLog(_EGL_FATAL, "failed to initialize \"current\" system"); return NULL; } |