Revert "glx: remove support for non-multithreaded platforms"
[mesa.git] / src / glx / glxclient.h
index 30c9e52139543cc923589d95d99c59643a39ba22..122ae5dd1b774946abb5c09ccff001b79ff81111 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <pthread.h>
 #include <stdint.h>
 #include "GL/glxproto.h"
 #include "glxconfig.h"
 #include "glxhash.h"
+#if defined( HAVE_PTHREAD )
+# include <pthread.h>
+#endif
 #include "util/macros.h"
 
 #include "glxextensions.h"
@@ -627,6 +629,7 @@ extern void __glXPreferEGL(int state);
 extern int __glXDebug;
 
 /* This is per-thread storage in an MT environment */
+#if defined( HAVE_PTHREAD )
 
 extern void __glXSetCurrentContext(struct glx_context * c);
 
@@ -643,6 +646,14 @@ extern struct glx_context *__glXGetCurrentContext(void);
 
 # endif /* defined( GLX_USE_TLS ) */
 
+#else
+
+extern struct glx_context *__glXcurrentContext;
+#define __glXGetCurrentContext() __glXcurrentContext
+#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
+
+#endif /* defined( HAVE_PTHREAD ) */
+
 extern void __glXSetCurrentContextNull(void);
 
 
@@ -650,9 +661,14 @@ extern void __glXSetCurrentContextNull(void);
 ** Global lock for all threads in this address space using the GLX
 ** extension
 */
+#if defined( HAVE_PTHREAD )
 extern pthread_mutex_t __glXmutex;
 #define __glXLock()    pthread_mutex_lock(&__glXmutex)
 #define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
+#else
+#define __glXLock()
+#define __glXUnlock()
+#endif
 
 /*
 ** Setup for a command.  Initialize the extension for dpy if necessary.