try using conditions for semaphores; standard semaphores are apparently too hard for OSX

This commit is contained in:
Glenn Maynard
2004-06-16 04:23:50 +00:00
parent cd59c6a68b
commit 2ec6b55568
2 changed files with 75 additions and 0 deletions
@@ -53,6 +53,7 @@ private:
pthread_mutex_t mutex;
};
#if 0
class SemaImpl_Pthreads: public SemaImpl
{
public:
@@ -66,6 +67,24 @@ public:
private:
sem_t sem;
};
#else
class SemaImpl_Pthreads: public SemaImpl
{
public:
SemaImpl_Pthreads( int iInitialValue );
~SemaImpl_Pthreads();
int GetValue() const { return m_iValue; }
void Post();
bool Wait();
bool TryWait();
private:
pthread_cond_t m_Cond;
pthread_mutex_t m_Mutex;
unsigned m_iValue;
};
#endif
#endif