3 * @Author Tu Yongce <yongce (at) 126 (dot) com>
9 #ifndef SHARED_MUTEX_H_INCLUDED
10 #define SHARED_MUTEX_H_INCLUDED
13 #error "works only on Windows"
24 HANDLE m_exclusiveEvent
;
26 volatile int m_sharedNum
;
27 volatile int m_exclusiveNum
;
28 volatile int m_lockType
;
30 static const int LOCK_NONE
= 0;
31 static const int LOCK_SHARED
= 1;
32 static const int LOCK_EXCLUSIVE
= 2;
38 // SharedMutex(SharedMutex &mutex);
39 // SharedMutex & operator = (SharedMutex &mutex);
44 bool AcquireShared(DWORD waitTime
= INFINITE
);
49 bool AcquireExclusive(DWORD waitTime
= INFINITE
);
51 void ReleaseExclusive();
54 #endif // SHARED_MUTEX_H_INCLUDED