From 385f23edf91a366b2e81449632ba3862957a2a74 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Jun 2006 14:50:05 +0000 Subject: Thread safety for Win32. SourceForge bug #1507315. --- src/mesa/drivers/windows/gdi/InitCritSections.cpp | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/mesa/drivers/windows/gdi/InitCritSections.cpp (limited to 'src/mesa/drivers/windows/gdi/InitCritSections.cpp') diff --git a/src/mesa/drivers/windows/gdi/InitCritSections.cpp b/src/mesa/drivers/windows/gdi/InitCritSections.cpp new file mode 100644 index 00000000000..7145bffa510 --- /dev/null +++ b/src/mesa/drivers/windows/gdi/InitCritSections.cpp @@ -0,0 +1,32 @@ +#include "glapi.h" +#include "glThread.h" + +#ifdef WIN32_THREADS +extern "C" _glthread_Mutex OneTimeLock; +extern "C" _glthread_Mutex GenTexturesLock; + +extern "C" void FreeAllTSD(void); + +class _CriticalSectionInit +{ +public: + static _CriticalSectionInit m_inst; + + _CriticalSectionInit() + { + _glthread_INIT_MUTEX(OneTimeLock); + _glthread_INIT_MUTEX(GenTexturesLock); + } + + ~_CriticalSectionInit() + { + _glthread_DESTROY_MUTEX(OneTimeLock); + _glthread_DESTROY_MUTEX(GenTexturesLock); + FreeAllTSD(); + } +}; + +_CriticalSectionInit _CriticalSectionInit::m_inst; + + +#endif -- cgit v1.2.3