summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi/glapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/glapi/glapi.c')
-rw-r--r--src/mesa/glapi/glapi.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index ed1a0c97da1..97cb1c8c8df 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1,4 +1,4 @@
-/* $Id: glapi.c,v 1.18 1999/12/17 14:51:28 brianp Exp $ */
+/* $Id: glapi.c,v 1.19 2000/01/05 04:36:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,7 +49,7 @@
/* Flag to indicate whether thread-safe dispatch is enabled */
-GLboolean _glapi_ThreadSafe = GL_FALSE;
+static GLboolean ThreadSafe = GL_FALSE;
/* This is used when thread safety is disabled */
static struct _glapi_table *Dispatch = &__glapi_noop_table;
@@ -95,7 +95,7 @@ void
_glapi_check_multithread(void)
{
#if defined(THREADS)
- if (!_glapi_ThreadSafe) {
+ if (!ThreadSafe) {
static unsigned long knownID;
static GLboolean firstCall = GL_TRUE;
if (firstCall) {
@@ -103,10 +103,10 @@ _glapi_check_multithread(void)
firstCall = GL_FALSE;
}
else if (knownID != _glthread_GetID()) {
- _glapi_ThreadSafe = GL_TRUE;
+ ThreadSafe = GL_TRUE;
}
}
- if (_glapi_ThreadSafe) {
+ if (ThreadSafe) {
/* make sure that this thread's dispatch pointer isn't null */
if (!_glapi_get_dispatch()) {
_glapi_set_dispatch(NULL);
@@ -127,7 +127,7 @@ _glapi_set_current_context(void *context)
{
#if defined(THREADS)
_glthread_SetTSD(&ContextTSD, context, context_thread_init);
- if (_glapi_ThreadSafe)
+ if (ThreadSafe)
_glapi_CurrentContext = NULL; /* to help with debugging */
else
_glapi_CurrentContext = context;
@@ -147,7 +147,7 @@ void *
_glapi_get_current_context(void)
{
#if defined(THREADS)
- if (_glapi_ThreadSafe) {
+ if (ThreadSafe) {
return _glthread_GetTSD(&ContextTSD);
}
else {
@@ -178,7 +178,7 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
#if defined(THREADS)
_glthread_SetTSD(&DispatchTSD, (void*) dispatch, dispatch_thread_init);
- if (_glapi_ThreadSafe)
+ if (ThreadSafe)
Dispatch = NULL; /* to help with debugging */
else
Dispatch = dispatch;
@@ -196,7 +196,7 @@ struct _glapi_table *
_glapi_get_dispatch(void)
{
#if defined(THREADS)
- if (_glapi_ThreadSafe) {
+ if (ThreadSafe) {
return (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD);
}
else {
@@ -505,14 +505,9 @@ _glapi_check_table(const struct _glapi_table *table)
#define NAME(func) gl##func
#endif
-#define DISPATCH_SETUP \
- const struct _glapi_table *dispatch; \
- if (_glapi_ThreadSafe) { \
- dispatch = _glapi_get_dispatch(); \
- } \
- else { \
- dispatch = Dispatch; \
- }
+#define DISPATCH_SETUP \
+ const struct _glapi_table *dispatch; \
+ dispatch = Dispatch ? Dispatch : _glapi_get_dispatch();
#define DISPATCH(FUNC, ARGS) (dispatch->FUNC) ARGS