Changeset 33:0eefa89dec31 in xplcommon
- Timestamp:
- 01/02/13 15:06:40 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/win32/Mutex.h
r32 r33 49 49 * The handle of the mutex. 50 50 */ 51 HANDLEmutex;51 CRITICAL_SECTION mutex; 52 52 53 53 public: … … 85 85 //------------------------------------------------------------------------------ 86 86 87 inline Mutex::Mutex() : 88 mutex(CreateMutex(0, false, 0)) 87 inline Mutex::Mutex() 89 88 { 89 InitializeCriticalSection(&mutex); 90 90 } 91 91 … … 94 94 inline Mutex::~Mutex() 95 95 { 96 CloseHandle(mutex);96 DeleteCriticalSection(&mutex); 97 97 } 98 98 … … 101 101 inline void Mutex::lock() 102 102 { 103 WaitForSingleObject(mutex, INFINITE);103 EnterCriticalSection(&mutex); 104 104 } 105 105 … … 108 108 inline bool Mutex::tryLock() 109 109 { 110 return WaitForSingleObject(mutex, 0) == WAIT_OBJECT_0;110 return TryEnterCriticalSection(&mutex); 111 111 } 112 112 … … 115 115 inline void Mutex::unlock() 116 116 { 117 ReleaseMutex(mutex);117 LeaveCriticalSection(&mutex); 118 118 } 119 119
Note:
See TracChangeset
for help on using the changeset viewer.