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>
This commit is contained in:
parent
2371b44f9e
commit
3692ff0b35
|
@ -179,57 +179,6 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
|
||||||
|
|
||||||
#endif /* WIN32_THREADS */
|
#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
|
* BeOS threads
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -68,8 +68,7 @@
|
||||||
#define _glapi_Dispatch _mglapi_Dispatch
|
#define _glapi_Dispatch _mglapi_Dispatch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(PTHREADS) || \
|
#if (defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)) \
|
||||||
defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \
|
|
||||||
&& !defined(THREADS)
|
&& !defined(THREADS)
|
||||||
# define THREADS
|
# define THREADS
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,49 +153,6 @@ typedef CRITICAL_SECTION _glthread_Mutex;
|
||||||
|
|
||||||
#endif /* WIN32_THREADS */
|
#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.
|
* BeOS threads. R5.x required.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user