glx: Remove usage of USE_ELF_TLS

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>
This commit is contained in:
Yonggang Luo 2022-06-25 13:31:52 +08:00 committed by Marge Bot
parent a055f285f5
commit aa0b857544
3 changed files with 0 additions and 68 deletions

View File

@ -650,18 +650,10 @@ extern int __glXDebug;
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);

View File

@ -67,8 +67,6 @@ struct glx_context dummyContext = {
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
# if defined( USE_ELF_TLS )
/**
* Per-thread GLX context pointer.
*
@ -84,56 +82,6 @@ __glXSetCurrentContext(struct glx_context * c)
__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)
{

View File

@ -99,11 +99,3 @@ struct glx_context dummyContext = {
&dummyVtable
};
__THREAD_INITIAL_EXEC void *__glX_tls_Context = &dummyContext;
#if !defined(USE_ELF_TLS)
extern "C" struct glx_context *
__glXGetCurrentContext()
{
return (struct glx_context *) __glX_tls_Context;
}
#endif