try using conditions for semaphores; standard semaphores are apparently too hard for OSX
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user