add TryLock

add semaphores
This commit is contained in:
Glenn Maynard
2004-06-14 05:21:46 +00:00
parent 34b3862833
commit cf9d31917f
5 changed files with 223 additions and 44 deletions
+23 -3
View File
@@ -20,15 +20,35 @@ public:
int Wait();
};
struct MutexImpl_Win32: public MutexImpl
class MutexImpl_Win32: public MutexImpl
{
HANDLE mutex;
public:
MutexImpl_Win32( RageMutex *parent );
~MutexImpl_Win32();
bool Lock();
bool TryLock();
void Unlock();
private:
HANDLE mutex;
};
class SemaImpl_Win32: public SemaImpl
{
public:
SemaImpl_Win32( int iInitialValue );
~SemaImpl_Win32();
int GetValue() const { return m_iCounter; }
void Post();
bool Wait();
bool TryWait();
private:
HANDLE sem;
/* We have to track the count ourself, since Windows gives no way to query it. */
int m_iCounter;
};
#endif