summaryrefslogtreecommitdiff
path: root/src/mapi/mapi/u_current.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapi/mapi/u_current.h')
-rw-r--r--src/mapi/mapi/u_current.h46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h
index 62e54c6c93..373d48fb93 100644
--- a/src/mapi/mapi/u_current.h
+++ b/src/mapi/mapi/u_current.h
@@ -8,16 +8,15 @@
/* ugly renames to match glapi.h */
#define mapi_table _glapi_table
-#define u_current_table_tls _glapi_tls_Dispatch
-#define u_current_user_tls _glapi_tls_Context
+#ifdef GLX_USE_TLS
+#define u_current_table _glapi_tls_Dispatch
+#define u_current_user _glapi_tls_Context
+#else
#define u_current_table _glapi_Dispatch
#define u_current_user _glapi_Context
+#endif
-#define u_current_destroy _glapi_destroy_multithread
-#define u_current_init _glapi_check_multithread
-#define u_current_set_internal _glapi_set_dispatch
#define u_current_get_internal _glapi_get_dispatch
-#define u_current_set_user_internal _glapi_set_context
#define u_current_get_user_internal _glapi_get_context
#define u_current_table_tsd _gl_DispatchTSD
@@ -30,15 +29,12 @@ struct mapi_table;
#ifdef GLX_USE_TLS
-extern __thread struct mapi_table *u_current_table_tls
+extern __thread struct mapi_table *u_current_table
__attribute__((tls_model("initial-exec")));
-extern __thread void *u_current_user_tls
+extern __thread void *u_current_user
__attribute__((tls_model("initial-exec")));
-extern const struct mapi_table *u_current_table;
-extern const void *u_current_user;
-
#else /* GLX_USE_TLS */
extern struct mapi_table *u_current_table;
@@ -46,6 +42,8 @@ extern void *u_current_user;
#endif /* GLX_USE_TLS */
+#endif /* MAPI_GLAPI_CURRENT */
+
void
u_current_init(void);
@@ -53,50 +51,36 @@ void
u_current_destroy(void);
void
-u_current_set_internal(struct mapi_table *tbl);
+u_current_set(const struct mapi_table *tbl);
struct mapi_table *
u_current_get_internal(void);
void
-u_current_set_user_internal(void *ptr);
+u_current_set_user(const void *ptr);
void *
u_current_get_user_internal(void);
-static INLINE void
-u_current_set(const struct mapi_table *tbl)
-{
- u_current_set_internal((struct mapi_table *) tbl);
-}
-
static INLINE const struct mapi_table *
u_current_get(void)
{
#ifdef GLX_USE_TLS
- return (const struct mapi_table *) u_current_table_tls;
+ return u_current_table;
#else
return (likely(u_current_table) ?
- (const struct mapi_table *) u_current_table : u_current_get_internal());
+ u_current_table : u_current_get_internal());
#endif
}
-static INLINE void
-u_current_set_user(void *ptr)
-{
- u_current_set_internal(ptr);
-}
-
-static INLINE void *
+static INLINE const void *
u_current_get_user(void)
{
#ifdef GLX_USE_TLS
- return u_current_user_tls;
+ return u_current_user;
#else
return likely(u_current_user) ? u_current_user : u_current_get_user_internal();
#endif
}
-#endif /* MAPI_GLAPI_CURRENT */
-
#endif /* _U_CURRENT_H_ */