summaryrefslogtreecommitdiff
path: root/src/GLdispatch/vnd-glapi
diff options
context:
space:
mode:
authorKyle Brenneman <kbrenneman@nvidia.com>2016-02-22 16:16:59 -0700
committerKyle Brenneman <kbrenneman@nvidia.com>2016-02-25 12:54:05 -0700
commit6c2a02b25d55e43705502f6d22aad80abf417ddd (patch)
tree1186fd1bd6560177f95553d6b71874abc5c5e860 /src/GLdispatch/vnd-glapi
parent4d977ea3896c2b57c13df1b02120c57a5b750c6a (diff)
Move the GLVNDPthreadFuncs struct into glvnd_pthread.c.
glvnd_pthread.h and glvnd_pthread.c now declare and define a GLVNDPthreadFuncs struct, instead of having a separate declaration in libGLX and libGLdispatch. This mostly just simplifies initialization a bit, but it will also make it easier to have common code that uses pthreads functions. Reviewed-by: Andy Ritger <aritger@nvidia.com>
Diffstat (limited to 'src/GLdispatch/vnd-glapi')
-rw-r--r--src/GLdispatch/vnd-glapi/mapi/u_current_tsd.c8
-rw-r--r--src/GLdispatch/vnd-glapi/mapi/u_thread.h10
2 files changed, 8 insertions, 10 deletions
diff --git a/src/GLdispatch/vnd-glapi/mapi/u_current_tsd.c b/src/GLdispatch/vnd-glapi/mapi/u_current_tsd.c
index 1687caf..0708da0 100644
--- a/src/GLdispatch/vnd-glapi/mapi/u_current_tsd.c
+++ b/src/GLdispatch/vnd-glapi/mapi/u_current_tsd.c
@@ -43,7 +43,7 @@ u_current_init(void)
{
int i;
for (i = 0; i < GLAPI_NUM_CURRENT_ENTRIES; i++) {
- if (pthreadFuncs.key_create(&u_current_tsd[i], NULL) != 0) {
+ if (__glvndPthreadFuncs.key_create(&u_current_tsd[i], NULL) != 0) {
perror("_glthread_: failed to allocate key for thread specific data");
abort();
}
@@ -57,7 +57,7 @@ u_current_destroy(void)
{
int i;
for (i = 0; i < GLAPI_NUM_CURRENT_ENTRIES; i++) {
- pthreadFuncs.key_delete(u_current_tsd[i]);
+ __glvndPthreadFuncs.key_delete(u_current_tsd[i]);
}
}
@@ -74,7 +74,7 @@ u_current_set_multithreaded(void)
void u_current_set(const struct _glapi_table *tbl)
{
- if (pthreadFuncs.setspecific(u_current_tsd[GLAPI_CURRENT_DISPATCH], (void *) tbl) != 0) {
+ if (__glvndPthreadFuncs.setspecific(u_current_tsd[GLAPI_CURRENT_DISPATCH], (void *) tbl) != 0) {
perror("_glthread_: thread failed to set thread specific data");
abort();
}
@@ -84,6 +84,6 @@ void u_current_set(const struct _glapi_table *tbl)
const struct _glapi_table *u_current_get(void)
{
return (const struct _glapi_table *) ((ThreadSafe) ?
- pthreadFuncs.getspecific(u_current_tsd[GLAPI_CURRENT_DISPATCH]) : _glapi_Current[GLAPI_CURRENT_DISPATCH]);
+ __glvndPthreadFuncs.getspecific(u_current_tsd[GLAPI_CURRENT_DISPATCH]) : _glapi_Current[GLAPI_CURRENT_DISPATCH]);
}
diff --git a/src/GLdispatch/vnd-glapi/mapi/u_thread.h b/src/GLdispatch/vnd-glapi/mapi/u_thread.h
index 336eea7..023a651 100644
--- a/src/GLdispatch/vnd-glapi/mapi/u_thread.h
+++ b/src/GLdispatch/vnd-glapi/mapi/u_thread.h
@@ -53,17 +53,15 @@
extern "C" {
#endif
-extern GLVNDPthreadFuncs pthreadFuncs;
-
typedef glvnd_mutex_t u_mutex;
#define u_mutex_declare_static(name) \
static u_mutex name = GLVND_MUTEX_INITIALIZER
-#define u_mutex_init(name) pthreadFuncs.mutex_init(&(name), NULL)
-#define u_mutex_destroy(name) pthreadFuncs.mutex_destroy(&(name))
-#define u_mutex_lock(name) (void) pthreadFuncs.mutex_lock(&(name))
-#define u_mutex_unlock(name) (void) pthreadFuncs.mutex_unlock(&(name))
+#define u_mutex_init(name) __glvndPthreadFuncs.mutex_init(&(name), NULL)
+#define u_mutex_destroy(name) __glvndPthreadFuncs.mutex_destroy(&(name))
+#define u_mutex_lock(name) (void) __glvndPthreadFuncs.mutex_lock(&(name))
+#define u_mutex_unlock(name) (void) __glvndPthreadFuncs.mutex_unlock(&(name))
#ifdef __cplusplus
}