本文整理汇总了C++中WaitCondition类的典型用法代码示例。如果您正苦于以下问题:C++ WaitCondition类的具体用法?C++ WaitCondition怎么用?C++ WaitCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WaitCondition类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SignalAndUnlock
void QuickLock::SignalAndUnlock(WaitCondition &condition)
{
if (!LogVerify(m_initialized))
return;
condition.Signal();
// Unlocking after is safer, but may be more expensive. In the simple case it
// could be unlocked before the signal. There are more complicated cases
// involving multiple waiters with different expectations, where this could be a
// problems. For now we err on the side of safety.
UnLock();
}
开发者ID:JakeMont,项目名称:OpenBFDD,代码行数:13,代码来源:threads.cpp
示例2: ShowAndWait
wait_result ShowAndWait (const WaitCondition& waitObj, unsigned timeOutSec, const CStdString& line1)
{
unsigned timeOutMs = timeOutSec * 1000;
if (m_dialog)
{
m_dialog->SetLine(1, line1);
m_dialog->SetPercentage(1); // avoid flickering by starting at 1% ..
}
XbmcThreads::EndTime end_time (timeOutMs);
while (!end_time.IsTimePast())
{
if (waitObj.SuccessWaiting())
return Success;
if (m_dialog)
{
if (!m_dialog->IsActive())
m_dialog->StartModal();
if (m_dialog->IsCanceled())
return Canceled;
m_dialog->Progress();
unsigned ms_passed = timeOutMs - end_time.MillisLeft();
int percentage = (ms_passed * 100) / timeOutMs;
m_dialog->SetPercentage(max(percentage, 1)); // avoid flickering , keep minimum 1%
}
Sleep (m_dialog ? 20 : 200);
}
return TimedOut;
}
开发者ID:cpaowner,项目名称:xbmc,代码行数:39,代码来源:WakeOnAccess.cpp
示例3: LockWait
int QuickLock::LockWait(WaitCondition &condition, uint32_t msTimeout)
{
if (!LogVerify(m_initialized))
return -1;
return condition.Wait(&m_Lock, msTimeout);
}
开发者ID:JakeMont,项目名称:OpenBFDD,代码行数:6,代码来源:threads.cpp
示例4: removeThread
void removeThread(Thread *pthread)
{
Mutex::Locker lock(&ThreadMutex);
ThreadSet.Remove(pthread);
if (ThreadSet.GetSize() == 0)
ThreadsEmpty.Notify();
}
开发者ID:w732,项目名称:LibOVR-2,代码行数:7,代码来源:OVR_ThreadsPthread.cpp
示例5: finishAllThreads
void finishAllThreads()
{
// Only original root thread can call this.
OVR_ASSERT(pthread_self() == RootThreadId);
Mutex::Locker lock(&ThreadMutex);
while (ThreadSet.GetSize() != 0)
ThreadsEmpty.Wait(&ThreadMutex);
}
开发者ID:w732,项目名称:LibOVR-2,代码行数:9,代码来源:OVR_ThreadsPthread.cpp
示例6: waitForStarted
void WatcherThread::waitForStarted()
{
MutexLocker locker(&mutex);
if (flags & Start)
return;
do {
waiter.wait(&mutex);
} while (!(flags & Start));
}
开发者ID:Andersbakken,项目名称:rtags-old-branches,代码行数:9,代码来源:FileSystemWatcher_fsevents.cpp
示例7: run
void WatcherThread::run()
{
{
MutexLocker locker(&mutex);
loop = CFRunLoopGetCurrent();
CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes);
flags |= Start;
waiter.wakeOne();
}
CFRunLoopRun();
}
开发者ID:Andersbakken,项目名称:rtags-old-branches,代码行数:11,代码来源:FileSystemWatcher_fsevents.cpp
注:本文中的WaitCondition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论