glapi: replace 'user' with 'context' in u_current.[ch] code
To make the functions more understandable. Reviewed-by: Chia-I Wu <olv@lunarg.com>
This commit is contained in:
parent
ef8a19ed4f
commit
280e065707
|
@ -54,7 +54,7 @@ _glapi_check_multithread(void)
|
||||||
void
|
void
|
||||||
_glapi_set_context(void *context)
|
_glapi_set_context(void *context)
|
||||||
{
|
{
|
||||||
u_current_set_user((const void *) context);
|
u_current_set_context((const void *) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -58,7 +58,7 @@ _glapi_check_multithread(void)
|
||||||
void
|
void
|
||||||
_glapi_set_context(void *context)
|
_glapi_set_context(void *context)
|
||||||
{
|
{
|
||||||
u_current_set_user((const void *) context);
|
u_current_set_context((const void *) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -103,18 +103,18 @@ __thread struct mapi_table *u_current_table
|
||||||
__attribute__((tls_model("initial-exec")))
|
__attribute__((tls_model("initial-exec")))
|
||||||
= (struct mapi_table *) table_noop_array;
|
= (struct mapi_table *) table_noop_array;
|
||||||
|
|
||||||
__thread void *u_current_user
|
__thread void *u_current_context
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
struct mapi_table *u_current_table =
|
struct mapi_table *u_current_table =
|
||||||
(struct mapi_table *) table_noop_array;
|
(struct mapi_table *) table_noop_array;
|
||||||
void *u_current_user;
|
void *u_current_context;
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
struct u_tsd u_current_table_tsd;
|
struct u_tsd u_current_table_tsd;
|
||||||
static struct u_tsd u_current_user_tsd;
|
static struct u_tsd u_current_context_tsd;
|
||||||
static int ThreadSafe;
|
static int ThreadSafe;
|
||||||
#endif /* THREADS */
|
#endif /* THREADS */
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ u_current_destroy(void)
|
||||||
{
|
{
|
||||||
#if defined(THREADS) && defined(_WIN32)
|
#if defined(THREADS) && defined(_WIN32)
|
||||||
u_tsd_destroy(&u_current_table_tsd);
|
u_tsd_destroy(&u_current_table_tsd);
|
||||||
u_tsd_destroy(&u_current_user_tsd);
|
u_tsd_destroy(&u_current_context_tsd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ static void
|
||||||
u_current_init_tsd(void)
|
u_current_init_tsd(void)
|
||||||
{
|
{
|
||||||
u_tsd_init(&u_current_table_tsd);
|
u_tsd_init(&u_current_table_tsd);
|
||||||
u_tsd_init(&u_current_user_tsd);
|
u_tsd_init(&u_current_context_tsd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +169,7 @@ u_current_init(void)
|
||||||
else if (knownID != u_thread_self()) {
|
else if (knownID != u_thread_self()) {
|
||||||
ThreadSafe = 1;
|
ThreadSafe = 1;
|
||||||
u_current_set(NULL);
|
u_current_set(NULL);
|
||||||
u_current_set_user(NULL);
|
u_current_set_context(NULL);
|
||||||
}
|
}
|
||||||
u_mutex_unlock(ThreadCheckMutex);
|
u_mutex_unlock(ThreadCheckMutex);
|
||||||
}
|
}
|
||||||
|
@ -191,17 +191,17 @@ u_current_init(void)
|
||||||
* void from the real context pointer type.
|
* void from the real context pointer type.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
u_current_set_user(const void *ptr)
|
u_current_set_context(const void *ptr)
|
||||||
{
|
{
|
||||||
u_current_init();
|
u_current_init();
|
||||||
|
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
u_current_user = (void *) ptr;
|
u_current_context = (void *) ptr;
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
u_tsd_set(&u_current_user_tsd, (void *) ptr);
|
u_tsd_set(&u_current_context_tsd, (void *) ptr);
|
||||||
u_current_user = (ThreadSafe) ? NULL : (void *) ptr;
|
u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
|
||||||
#else
|
#else
|
||||||
u_current_user = (void *) ptr;
|
u_current_context = (void *) ptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,16 +211,16 @@ u_current_set_user(const void *ptr)
|
||||||
* void to the real context pointer type.
|
* void to the real context pointer type.
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
u_current_get_user_internal(void)
|
u_current_get_context_internal(void)
|
||||||
{
|
{
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(GLX_USE_TLS)
|
||||||
return u_current_user;
|
return u_current_context;
|
||||||
#elif defined(THREADS)
|
#elif defined(THREADS)
|
||||||
return (ThreadSafe)
|
return (ThreadSafe)
|
||||||
? u_tsd_get(&u_current_user_tsd)
|
? u_tsd_get(&u_current_context_tsd)
|
||||||
: u_current_user;
|
: u_current_context;
|
||||||
#else
|
#else
|
||||||
return u_current_user;
|
return u_current_context;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,14 @@
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef GLX_USE_TLS
|
||||||
#define u_current_table _glapi_tls_Dispatch
|
#define u_current_table _glapi_tls_Dispatch
|
||||||
#define u_current_user _glapi_tls_Context
|
#define u_current_context _glapi_tls_Context
|
||||||
#else
|
#else
|
||||||
#define u_current_table _glapi_Dispatch
|
#define u_current_table _glapi_Dispatch
|
||||||
#define u_current_user _glapi_Context
|
#define u_current_context _glapi_Context
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define u_current_get_internal _glapi_get_dispatch
|
#define u_current_get_internal _glapi_get_dispatch
|
||||||
#define u_current_get_user_internal _glapi_get_context
|
#define u_current_get_context_internal _glapi_get_context
|
||||||
|
|
||||||
#define u_current_table_tsd _gl_DispatchTSD
|
#define u_current_table_tsd _gl_DispatchTSD
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ struct mapi_table;
|
||||||
extern __thread struct mapi_table *u_current_table
|
extern __thread struct mapi_table *u_current_table
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
|
|
||||||
extern __thread void *u_current_user
|
extern __thread void *u_current_context
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
|
|
||||||
#else /* GLX_USE_TLS */
|
#else /* GLX_USE_TLS */
|
||||||
|
|
||||||
extern struct mapi_table *u_current_table;
|
extern struct mapi_table *u_current_table;
|
||||||
extern void *u_current_user;
|
extern void *u_current_context;
|
||||||
|
|
||||||
#endif /* GLX_USE_TLS */
|
#endif /* GLX_USE_TLS */
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ struct mapi_table *
|
||||||
u_current_get_internal(void);
|
u_current_get_internal(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
u_current_set_user(const void *ptr);
|
u_current_set_context(const void *ptr);
|
||||||
|
|
||||||
void *
|
void *
|
||||||
u_current_get_user_internal(void);
|
u_current_get_context_internal(void);
|
||||||
|
|
||||||
static INLINE const struct mapi_table *
|
static INLINE const struct mapi_table *
|
||||||
u_current_get(void)
|
u_current_get(void)
|
||||||
|
@ -75,12 +75,12 @@ u_current_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE const void *
|
static INLINE const void *
|
||||||
u_current_get_user(void)
|
u_current_get_context(void)
|
||||||
{
|
{
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef GLX_USE_TLS
|
||||||
return u_current_user;
|
return u_current_context;
|
||||||
#else
|
#else
|
||||||
return likely(u_current_user) ? u_current_user : u_current_get_user_internal();
|
return likely(u_current_context) ? u_current_context : u_current_get_context_internal();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue