You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
695 B
40 lines
695 B
14 years ago
|
#ifndef SyncObject_Win32_h
|
||
|
#define SyncObject_Win32_h
|
||
|
|
||
|
#ifndef SyncObject_h
|
||
|
# error include SyncObject.h instead
|
||
|
#endif
|
||
|
|
||
|
#ifndef _WIN32_WINNT
|
||
|
# define _WIN32_WINNT 0x0403
|
||
|
#endif
|
||
|
#include <windows.h>
|
||
|
|
||
|
namespace act
|
||
|
{
|
||
|
class SyncObject
|
||
|
{
|
||
|
private:
|
||
|
SyncObject(const SyncObject&);
|
||
|
SyncObject& operator=(const SyncObject&);
|
||
|
|
||
|
public:
|
||
|
SyncObject();
|
||
|
~SyncObject();
|
||
|
|
||
|
void lock();
|
||
|
void unlock();
|
||
|
|
||
|
long lockCount() const { return m_lock_count; }
|
||
|
DWORD threadId() const { return m_thread_id; }
|
||
|
|
||
|
private:
|
||
|
volatile long m_lock_count;
|
||
|
volatile DWORD m_thread_id;
|
||
|
CRITICAL_SECTION m_sync;
|
||
|
};
|
||
|
|
||
|
} // namespace act
|
||
|
|
||
|
#endif // SyncObject_Win32_h
|