mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: ConditionVariable::Wait(timeout_ms) in linux
git-svn-id: svn://ultimatepp.org/upp/trunk@13773 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c3b63417cc
commit
ae7712c559
2 changed files with 4 additions and 4 deletions
|
|
@ -637,7 +637,7 @@ RWMutex::~RWMutex()
|
|||
pthread_rwlock_destroy(rwlock);
|
||||
}
|
||||
|
||||
void ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
||||
bool ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
||||
{
|
||||
struct timespec until;
|
||||
clock_gettime(CLOCK_REALTIME, &until);
|
||||
|
|
@ -648,7 +648,7 @@ void ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
|||
until.tv_sec += until.tv_nsec / 1000000000;
|
||||
until.tv_nsec %= 1000000000;
|
||||
|
||||
return pthread_cond_timedwait(cv, m.mutex, &until);
|
||||
return pthread_cond_timedwait(cv, m.mutex, &until) == 0;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_OSX
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class ConditionVariable {
|
|||
|
||||
public:
|
||||
void Wait(Mutex& m);
|
||||
void Wait(Mutex& m, int timeout_ms);
|
||||
bool Wait(Mutex& m, int timeout_ms);
|
||||
void Signal();
|
||||
void Broadcast();
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ class ConditionVariable {
|
|||
|
||||
public:
|
||||
void Wait(Mutex& m) { pthread_cond_wait(cv, m.mutex); }
|
||||
void Wait(Mutex& m, int timeout_ms);
|
||||
bool Wait(Mutex& m, int timeout_ms);
|
||||
|
||||
void Signal() { pthread_cond_signal(cv); }
|
||||
void Broadcast() { pthread_cond_broadcast(cv); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue