From c7bbc9ad126b2b120407146c5aa9894f4487752e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 23 Feb 2009 11:52:59 +0000 Subject: [PATCH] wgl: Enable the use of Win32 threads. --- src/gallium/state_trackers/wgl/SConscript | 1 + .../state_trackers/wgl/shared/stw_device.c | 15 +++++++++++++++ src/mesa/SConscript | 1 + 3 files changed, 17 insertions(+) diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index d2c41f49c51..2141b02d688 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -14,6 +14,7 @@ if env['platform'] in ['windows']: env.Append(CPPDEFINES = [ '_GDI32_', # prevent wgl* being declared __declspec(dllimport) 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers + 'WIN32_THREADS', # use Win32 thread API ]) sources = [ diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 097e6ea62b3..0dca856d73b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -27,6 +27,7 @@ #include +#include "glapi/glthread.h" #include "util/u_debug.h" #include "pipe/p_screen.h" @@ -35,6 +36,11 @@ #include "shared/stw_pixelformat.h" #include "shared/stw_public.h" +#ifdef WIN32_THREADS +extern _glthread_Mutex OneTimeLock; +extern void FreeAllTSD(void); +#endif + struct stw_device *stw_dev = NULL; @@ -73,6 +79,10 @@ st_init(const struct stw_winsys *stw_winsys) stw_dev->stw_winsys = stw_winsys; +#ifdef WIN32_THREADS + _glthread_INIT_MUTEX(OneTimeLock); +#endif + stw_dev->screen = stw_winsys->create_screen(); if(!stw_dev->screen) goto error1; @@ -114,6 +124,11 @@ st_cleanup(void) stw_dev->screen->destroy(stw_dev->screen); +#ifdef WIN32_THREADS + _glthread_DESTROY_MUTEX(OneTimeLock); + FreeAllTSD(); +#endif + #ifdef DEBUG debug_memory_end(stw_dev->memdbg_no); #endif diff --git a/src/mesa/SConscript b/src/mesa/SConscript index a878d31dbb5..5cf3bfd9d54 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -16,6 +16,7 @@ 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 ]) # -- 2.30.2