extern void __glXSetCurrentContext(struct glx_context * c);
-# if defined( USE_ELF_TLS )
-
extern __THREAD_INITIAL_EXEC void *__glX_tls_Context;
# define __glXGetCurrentContext() __glX_tls_Context
-# else
-
-extern struct glx_context *__glXGetCurrentContext(void);
-
-# endif /* defined( USE_ELF_TLS ) */
-
extern void __glXSetCurrentContextNull(void);
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
-# if defined( USE_ELF_TLS )
-
/**
* Per-thread GLX context pointer.
*
__glX_tls_Context = (c != NULL) ? c : &dummyContext;
}
-# else
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-/**
- * Per-thread data key.
- *
- * Once \c init_thread_data has been called, the per-thread data key will
- * take a value of \c NULL. As each new thread is created the default
- * value, in that thread, will be \c NULL.
- */
-static pthread_key_t ContextTSD;
-
-/**
- * Initialize the per-thread data key.
- *
- * This function is called \b exactly once per-process (not per-thread!) to
- * initialize the per-thread data key. This is ideally done using the
- * \c pthread_once mechanism.
- */
-static void
-init_thread_data(void)
-{
- if (pthread_key_create(&ContextTSD, NULL) != 0) {
- perror("pthread_key_create");
- exit(-1);
- }
-}
-
-_X_HIDDEN void
-__glXSetCurrentContext(struct glx_context * c)
-{
- pthread_once(&once_control, init_thread_data);
- pthread_setspecific(ContextTSD, c);
-}
-
-_X_HIDDEN struct glx_context *
-__glXGetCurrentContext(void)
-{
- void *v;
-
- pthread_once(&once_control, init_thread_data);
-
- v = pthread_getspecific(ContextTSD);
- return (v == NULL) ? &dummyContext : (struct glx_context *) v;
-}
-
-# endif /* defined( USE_ELF_TLS ) */
-
-
_X_HIDDEN void
__glXSetCurrentContextNull(void)
{