From: Mikko L. <laz...@us...> - 2004-06-13 19:54:34
|
Update of /cvsroot/rtk/rtk/src/core/platform/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14600 Modified Files: Mutex.cpp Log Message: moved all OS specific header to source file Index: Mutex.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/platform/win32/Mutex.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mutex.cpp 21 Feb 2004 10:06:54 -0000 1.2 --- Mutex.cpp 13 Jun 2004 19:54:25 -0000 1.3 *************** *** 46,72 **** */ #include <rtk/Mutex.h> namespace Rtk { void Mutex::Init() { ! InitializeCriticalSection(&_cs); } void Mutex::Destroy() { ! DeleteCriticalSection(&_cs); } void Mutex::Lock() { ! EnterCriticalSection(&_cs); } void Mutex::Unlock() { ! LeaveCriticalSection(&_cs); } --- 46,91 ---- */ + #include <rtk/Mutex.h> + #include <stdlib.h> + #ifndef _WIN32_WCE + # include <process.h> + #endif + #include <windows.h> + #include <limits.h> + namespace Rtk { + struct _private_data + { + CRITICAL_SECTION cs; + }; + + #define PRV ((struct _private_data*)_prv) + void Mutex::Init() { ! _prv = malloc(sizeof(_private_data)); ! memset(_prv, 0, sizeof(_private_data)); ! InitializeCriticalSection(&PRV->cs); } void Mutex::Destroy() { ! DeleteCriticalSection(&PRV->cs); ! free(_prv); ! _prv = 0; } void Mutex::Lock() { ! EnterCriticalSection(&PRV->cs); } void Mutex::Unlock() { ! LeaveCriticalSection(&PRV->cs); } |