diff options
author | Adam Jackson <ajax@redhat.com> | 2011-03-02 11:22:45 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2011-03-08 13:22:09 -0500 |
commit | 3692ff0b35e774a6f6cbedf634d53c4df2e53a24 (patch) | |
tree | 7c1542e1be018d8965accc10ecd8eb754f8c5be4 /glx | |
parent | 2371b44f9eb9181ec2c081ce66befee51d18bf6e (diff) |
glx: unifdef USE_XTHREADS
xthreads is an ancient wrapper around a half dozen or so common thread
APIs, including pthreads. Just use pthreads directly if you have it; if
you don't, get with the times.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r-- | glx/glthread.c | 51 | ||||
-rw-r--r-- | glx/glthread.h | 46 |
2 files changed, 1 insertions, 96 deletions
diff --git a/glx/glthread.c b/glx/glthread.c index 2d76a49b7..a2d95b51c 100644 --- a/glx/glthread.c +++ b/glx/glthread.c @@ -179,57 +179,6 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) #endif /* WIN32_THREADS */ - - -/* - * XFree86 has its own thread wrapper, Xthreads.h - * We wrap it again for GL. - */ -#ifdef USE_XTHREADS - -_X_EXPORT unsigned long -_glthread_GetID(void) -{ - return (unsigned long) xthread_self(); -} - - -void -_glthread_InitTSD(_glthread_TSD *tsd) -{ - if (xthread_key_create(&tsd->key, NULL) != 0) { - perror(INIT_TSD_ERROR); - exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - - -void * -_glthread_GetTSD(_glthread_TSD *tsd) -{ - void *ptr; - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - xthread_get_specific(tsd->key, &ptr); - return ptr; -} - - -void -_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) -{ - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - xthread_set_specific(tsd->key, ptr); -} - -#endif /* XTHREAD */ - - - /* * BeOS threads */ diff --git a/glx/glthread.h b/glx/glthread.h index e7e2385c0..782a2a314 100644 --- a/glx/glthread.h +++ b/glx/glthread.h @@ -68,8 +68,7 @@ #define _glapi_Dispatch _mglapi_Dispatch #endif -#if (defined(PTHREADS) || \ - defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \ +#if (defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)) \ && !defined(THREADS) # define THREADS #endif @@ -154,49 +153,6 @@ typedef CRITICAL_SECTION _glthread_Mutex; #endif /* WIN32_THREADS */ - - - -/* - * XFree86 has its own thread wrapper, Xthreads.h - * We wrap it again for GL. - */ -#ifdef USE_XTHREADS -#include <X11/Xthreads.h> - -typedef struct { - xthread_key_t key; - int initMagic; -} _glthread_TSD; - -typedef xthread_t _glthread_Thread; - -typedef xmutex_rec _glthread_Mutex; - -#ifdef XMUTEX_INITIALIZER -#define _glthread_DECLARE_STATIC_MUTEX(name) \ - static _glthread_Mutex name = XMUTEX_INITIALIZER -#else -#define _glthread_DECLARE_STATIC_MUTEX(name) \ - static _glthread_Mutex name -#endif - -#define _glthread_INIT_MUTEX(name) \ - xmutex_init(&(name)) - -#define _glthread_DESTROY_MUTEX(name) \ - xmutex_clear(&(name)) - -#define _glthread_LOCK_MUTEX(name) \ - (void) xmutex_lock(&(name)) - -#define _glthread_UNLOCK_MUTEX(name) \ - (void) xmutex_unlock(&(name)) - -#endif /* USE_XTHREADS */ - - - /* * BeOS threads. R5.x required. */ |