egl: Use _eglAddAtExitCall to free thread infos and displays.

Thread infos and displays are usually not freed by applications.  This
commit add atexit calls to free them.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
Chia-I Wu 2009-08-10 16:45:12 +08:00 committed by Brian Paul
parent 435c7ac24d
commit 64e7bb3262
2 changed files with 4 additions and 3 deletions

View file

@ -4,6 +4,7 @@
#include "eglcontext.h"
#include "egllog.h"
#include "eglmutex.h"
#include "eglglobals.h"
/* This should be kept in sync with _eglInitThreadInfo() */
@ -84,7 +85,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_FALSE;
}
_egl_FreeTSD = dtor;
(void) _eglFiniTSD;
_eglAddAtExitCall(_eglFiniTSD);
_egl_TSDInitialized = EGL_TRUE;
}
@ -118,7 +119,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
{
if (!_egl_FreeTSD && dtor) {
_egl_FreeTSD = dtor;
(void) _eglFiniTSD;
_eglAddAtExitCall(_eglFiniTSD);
}
return EGL_TRUE;
}

View file

@ -67,7 +67,7 @@ _eglInitDisplay(void)
_eglDisplayHash = _eglNewHashTable();
_eglSurfaceHash = _eglNewHashTable();
(void) _eglFiniDisplay;
_eglAddAtExitCall(_eglFiniDisplay);
}
_eglUnlockMutex(&_eglDisplayInitMutex);