print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
print '# endif'
print ''
- print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
- print '# define THREADS'
- print '#endif'
- print ''
print '\t.text'
print ''
print '#ifdef GLX_USE_TLS'
print '\tmovl\t(%rax), %edi'
print '\tjmp\tpthread_getspecific@PLT'
print ''
- print '#elif defined(THREADS)'
+ print '#else'
print ''
print '\t.extern\t_glapi_get_dispatch'
print ''
print '#define GLOBL_FN(x) GLOBL x'
print '#endif'
print ''
- print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
- print '# define THREADS'
- print '#endif'
print ''
print '#ifdef GLX_USE_TLS'
print ''
print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
print '1:\tCALL(_x86_get_dispatch) ;\t\t\t\\'
print '\tJMP(GL_OFFSET(off))'
- print '#elif defined(THREADS)'
+ print '#else'
print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
print '1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\'
print '\tJMP(GL_OFFSET(off))'
- print '#else /* Non-threaded version. */'
- print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
- print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
- print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
- print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
- print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
- print '\tJMP(GL_OFFSET(off))'
print '#endif'
print ''
print '#ifdef HAVE_ALIAS'
print '\tCALL(GLNAME(pthread_getspecific))'
print '\tADD_L(CONST(28), ESP)'
print '\tRET'
- print '#elif defined(THREADS)'
+ print '#else'
print 'EXTERN GLNAME(_glapi_get_dispatch)'
print '#endif'
print ''
_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
_GLAPI_EXPORT extern void *_glapi_Context;
-# ifdef THREADS
-
-# define GET_DISPATCH() \
+#define GET_DISPATCH() \
(likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
-# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
+#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
-# else
-
-# define GET_DISPATCH() _glapi_Dispatch
-# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_Context
-
-# endif
-
#endif /* defined (GLX_USE_TLS) */
#if defined(GLX_USE_TLS)
*((unsigned int *)(code + 8)) = 4 * offset;
-#elif defined(THREADS)
+#else
*((unsigned int *)(code + 11)) = 4 * offset;
*((unsigned int *)(code + 22)) = 4 * offset;
-#else
- *((unsigned int *)(code + 7)) = 4 * offset;
#endif
}
#if defined(USE_X86_ASM)
# if defined(GLX_USE_TLS)
# define DISPATCH_FUNCTION_SIZE 16
-# elif defined(THREADS)
-# define DISPATCH_FUNCTION_SIZE 32
# else
-# define DISPATCH_FUNCTION_SIZE 16
+# define DISPATCH_FUNCTION_SIZE 32
# endif
#endif
(struct mapi_table *) table_noop_array;
void *u_current_context;
-#ifdef THREADS
struct u_tsd u_current_table_tsd;
static struct u_tsd u_current_context_tsd;
static int ThreadSafe;
-#endif /* THREADS */
#endif /* defined(GLX_USE_TLS) */
/*@}*/
void
u_current_destroy(void)
{
-#if defined(THREADS) && !defined(GLX_USE_TLS)
+#if !defined(GLX_USE_TLS)
u_tsd_destroy(&u_current_table_tsd);
u_tsd_destroy(&u_current_context_tsd);
#endif
}
-#if defined(THREADS) && !defined(GLX_USE_TLS)
+#if !defined(GLX_USE_TLS)
static void
u_current_init_tsd(void)
#if defined(GLX_USE_TLS)
u_current_context = (void *) ptr;
-#elif defined(THREADS)
+#else
u_tsd_set(&u_current_context_tsd, (void *) ptr);
u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
-#else
- u_current_context = (void *) ptr;
#endif
}
{
#if defined(GLX_USE_TLS)
return u_current_context;
-#elif defined(THREADS)
+#else
return (ThreadSafe)
? u_tsd_get(&u_current_context_tsd)
: u_current_context;
-#else
- return u_current_context;
#endif
}
#if defined(GLX_USE_TLS)
u_current_table = (struct mapi_table *) tbl;
-#elif defined(THREADS)
+#else
u_tsd_set(&u_current_table_tsd, (void *) tbl);
u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
-#else
- u_current_table = (struct mapi_table *) tbl;
#endif
}
{
#if defined(GLX_USE_TLS)
return u_current_table;
-#elif defined(THREADS)
+#else
return (struct mapi_table *) ((ThreadSafe) ?
u_tsd_get(&u_current_table_tsd) : (void *) u_current_table);
-#else
- return u_current_table;
#endif
}
#include "c11/threads.h"
-#if defined(HAVE_PTHREAD) || defined(_WIN32)
-#ifndef THREADS
-#define THREADS
-#endif
-#endif
-
/*
* Error messages
*/