Mesa (master): WIN32_THREADS -> WIN32

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Dec 2 17:39:45 UTC 2010


Module: Mesa
Branch: master
Commit: e3659329e0b91ea78afe32e231f2f75d3d728af9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3659329e0b91ea78afe32e231f2f75d3d728af9

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Dec  2 17:27:05 2010 +0000

WIN32_THREADS -> WIN32

Fixes nasty bug where some parts of the code didn't define WIN32_THREADS
and were using the integer mutex implementation, causing even confusion
to the debuggers.

And there is little interest of other thread implemenation on Win32
besides Win32 threads.

---

 src/gallium/state_trackers/wgl/SConscript         |    1 -
 src/gallium/state_trackers/wgl/stw_device.c       |    6 ------
 src/mapi/glapi/SConscript                         |    1 -
 src/mapi/glapi/gen/gl_x86-64_asm.py               |    2 +-
 src/mapi/glapi/gen/gl_x86_asm.py                  |    2 +-
 src/mapi/glapi/glapi_x86-64.S                     |    2 +-
 src/mapi/glapi/glapi_x86.S                        |    2 +-
 src/mapi/mapi/u_current.c                         |    4 ++--
 src/mapi/mapi/u_thread.c                          |    4 ++--
 src/mapi/mapi/u_thread.h                          |    6 +++---
 src/mesa/SConscript                               |    1 -
 src/mesa/drivers/windows/gdi/InitCritSections.cpp |    5 +++--
 12 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index 936f550..1b7597d 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -13,7 +13,6 @@ env.Append(CPPPATH = [
 env.AppendUnique(CPPDEFINES = [
     '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
     'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 
-    'WIN32_THREADS', # use Win32 thread API
     'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
 ])
 
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 7227dc2..c4822d4 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -41,9 +41,7 @@
 #include "stw_framebuffer.h"
 #include "stw_st.h"
 
-#ifdef WIN32_THREADS
 extern _glthread_Mutex OneTimeLock;
-#endif
 
 
 struct stw_device *stw_dev = NULL;
@@ -76,9 +74,7 @@ stw_init(const struct stw_winsys *stw_winsys)
    
    stw_dev->stw_winsys = stw_winsys;
 
-#ifdef WIN32_THREADS
    _glthread_INIT_MUTEX(OneTimeLock);
-#endif
 
    stw_dev->stapi = stw_st_create_api();
    stw_dev->smapi = CALLOC_STRUCT(st_manager);
@@ -172,11 +168,9 @@ stw_cleanup(void)
 
    stw_dev->screen->destroy(stw_dev->screen);
 
-#ifdef WIN32_THREADS
    _glthread_DESTROY_MUTEX(OneTimeLock);
 
    _glapi_destroy_multithread();
-#endif
 
 #ifdef DEBUG
    debug_memory_end(stw_dev->memdbg_no);
diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
index 77a5f9b..4ef855f 100644
--- a/src/mapi/glapi/SConscript
+++ b/src/mapi/glapi/SConscript
@@ -16,7 +16,6 @@ if env['platform'] != 'winddk':
         env.Append(CPPDEFINES = [
             '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
             'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
-            'WIN32_THREADS', # use Win32 thread API
         ])
 
     env.Append(CPPPATH = [
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index e6e78c4..2fa140d 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -138,7 +138,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 		print '#  define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
 		print '# endif'
 		print ''
-		print '#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+		print '#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)'
 		print '#  define THREADS'
 		print '#endif'
 		print ''
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index 3b1d035..21996a3 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -78,7 +78,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 		print '#define GLOBL_FN(x) GLOBL x'
 		print '#endif'
 		print ''
-		print '#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+		print '#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)'
 		print '#  define THREADS'
 		print '#endif'
 		print ''
diff --git a/src/mapi/glapi/glapi_x86-64.S b/src/mapi/glapi/glapi_x86-64.S
index ce0cf68..af46f2b 100644
--- a/src/mapi/glapi/glapi_x86-64.S
+++ b/src/mapi/glapi/glapi_x86-64.S
@@ -45,7 +45,7 @@
 #  define GL_PREFIX(n) GLNAME(CONCAT(gl,n))
 # endif
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 
diff --git a/src/mapi/glapi/glapi_x86.S b/src/mapi/glapi/glapi_x86.S
index 72729f2..215295d 100644
--- a/src/mapi/glapi/glapi_x86.S
+++ b/src/mapi/glapi/glapi_x86.S
@@ -51,7 +51,7 @@
 #define GLOBL_FN(x) GLOBL x
 #endif
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #  define THREADS
 #endif
 
diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c
index ed9ccfe..77a593b 100644
--- a/src/mapi/mapi/u_current.c
+++ b/src/mapi/mapi/u_current.c
@@ -128,7 +128,7 @@ static int ThreadSafe;
 void
 u_current_destroy(void)
 {
-#if defined(THREADS) && defined(WIN32_THREADS)
+#if defined(THREADS) && defined(WIN32)
    u_tsd_destroy(&u_current_table_tsd);
    u_tsd_destroy(&u_current_user_tsd);
 #endif
@@ -147,7 +147,7 @@ u_current_init_tsd(void)
 /**
  * Mutex for multithread check.
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 /* _glthread_DECLARE_STATIC_MUTEX is broken on windows.  There will be race! */
 #define CHECK_MULTITHREAD_LOCK()
 #define CHECK_MULTITHREAD_UNLOCK()
diff --git a/src/mapi/mapi/u_thread.c b/src/mapi/mapi/u_thread.c
index e0fa64a..e9eae55 100644
--- a/src/mapi/mapi/u_thread.c
+++ b/src/mapi/mapi/u_thread.c
@@ -111,7 +111,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
  * Be sure that you compile using the Multithreaded runtime, otherwise
  * bad things will happen.
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 
 static void InsteadOf_exit(int nCode)
 {
@@ -172,7 +172,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr)
    }
 }
 
-#endif /* WIN32_THREADS */
+#endif /* WIN32 */
 
 /*
  * BeOS threads
diff --git a/src/mapi/mapi/u_thread.h b/src/mapi/mapi/u_thread.h
index b4487a3..92a0a39 100644
--- a/src/mapi/mapi/u_thread.h
+++ b/src/mapi/mapi/u_thread.h
@@ -44,7 +44,7 @@
 
 #include "u_compiler.h"
 
-#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)
+#if defined(PTHREADS) || defined(WIN32) || defined(BEOS_THREADS)
 #ifndef THREADS
 #define THREADS
 #endif
@@ -85,7 +85,7 @@ typedef pthread_mutex_t u_mutex;
  * IMPORTANT: Link with multithreaded runtime library when THREADS are
  * used!
  */
-#ifdef WIN32_THREADS
+#ifdef WIN32
 #include <windows.h>
 
 struct u_tsd {
@@ -104,7 +104,7 @@ typedef CRITICAL_SECTION u_mutex;
 #define u_mutex_lock(name)    EnterCriticalSection(&name)
 #define u_mutex_unlock(name)  LeaveCriticalSection(&name)
 
-#endif /* WIN32_THREADS */
+#endif /* WIN32 */
 
 
 /*
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 08d731d..cc4ad09 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -16,7 +16,6 @@ if env['platform'] == 'windows':
     env.Append(CPPDEFINES = [
         '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
         'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
-        'WIN32_THREADS', # use Win32 thread API
     ])
     env.Prepend(CPPPATH = ['#src/talloc'])
 else:
diff --git a/src/mesa/drivers/windows/gdi/InitCritSections.cpp b/src/mesa/drivers/windows/gdi/InitCritSections.cpp
index 7145bff..69f03b8 100644
--- a/src/mesa/drivers/windows/gdi/InitCritSections.cpp
+++ b/src/mesa/drivers/windows/gdi/InitCritSections.cpp
@@ -1,7 +1,8 @@
 #include "glapi.h"
 #include "glThread.h"
 
-#ifdef WIN32_THREADS
+#ifdef WIN32
+
 extern "C" _glthread_Mutex OneTimeLock;
 extern "C" _glthread_Mutex GenTexturesLock;
 
@@ -29,4 +30,4 @@ public:
 _CriticalSectionInit _CriticalSectionInit::m_inst;
 
 
-#endif
+#endif /* WIN32 */




More information about the mesa-commit mailing list