mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: ConditionVariable::Wait(timeout_ms) in Win32
git-svn-id: svn://ultimatepp.org/upp/trunk@13774 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ae7712c559
commit
cae0e6eb79
1 changed files with 4 additions and 3 deletions
|
|
@ -540,10 +540,10 @@ void ConditionVariable::Wait(Mutex& m)
|
|||
}
|
||||
}
|
||||
|
||||
void ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
||||
bool ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
||||
{
|
||||
if(InitializeConditionVariable)
|
||||
SleepConditionVariableCS(cv, &m.section, timeout_ms);
|
||||
return SleepConditionVariableCS(cv, &m.section, timeout_ms);
|
||||
else { // WindowsXP implementation
|
||||
static thread_local byte buffer[sizeof(WaitingThread)]; // only one Wait per thread is possible
|
||||
WaitingThread *w = new(buffer) WaitingThread;
|
||||
|
|
@ -557,9 +557,10 @@ void ConditionVariable::Wait(Mutex& m, int timeout_ms)
|
|||
tail = w;
|
||||
}
|
||||
m.Leave();
|
||||
w->sem.Wait(timeout_ms);
|
||||
bool r = w->sem.Wait(timeout_ms);
|
||||
m.Enter();
|
||||
w->WaitingThread::~WaitingThread();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue