47 lines
765 B
C++
47 lines
765 B
C++
#ifndef SyncObject_MacOS_h
|
|
#define SyncObject_MacOS_h
|
|
|
|
#ifndef SyncObject_h
|
|
# error include SyncObject.h instead
|
|
#endif
|
|
|
|
#include <CoreServices/CoreServices.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; }
|
|
MPTaskID threadId() const { return m_thread_id; }
|
|
|
|
private:
|
|
volatile long m_lock_count;
|
|
volatile MPTaskID m_thread_id;
|
|
MPCriticalRegionID m_sync;
|
|
};
|
|
|
|
void Sleep(long msec);
|
|
|
|
} // namespace act
|
|
|
|
#ifdef verify
|
|
# undef verify
|
|
#endif
|
|
|
|
#ifdef check
|
|
# undef check
|
|
#endif
|
|
|
|
#endif // SyncObject_MacOS_h
|