本文整理汇总了C++中ConditionVariable::notifyOne方法的典型用法代码示例。如果您正苦于以下问题:C++ ConditionVariable::notifyOne方法的具体用法?C++ ConditionVariable::notifyOne怎么用?C++ ConditionVariable::notifyOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConditionVariable
的用法示例。
在下文中一共展示了ConditionVariable::notifyOne方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assignNewTask
/// Assign new task to the thread
void assignNewTask(Threadpool::Task* task)
{
m_mutex.lock();
ANKI_ASSERT(m_task == nullptr && "Probably forgot to wait for tasks");
m_task = task;
m_mutex.unlock();
m_condVar.notifyOne(); // Wake the thread
}
示例2: start
/**
Starts the ticks generation.
You can use this member function even when timer is running (to restart it).
*/
void Timer::start()
{
// start/create timer thread (if this is the first Timer started)
Timer::start_timer_thread();
{
ScopedLock hold(timer_mutex);
if (!m_running) {
// add timer
timers.push_back(this);
m_running = true;
}
m_firstTick = true;
m_timeCounter = m_interval;
m_tickCounter = 0;
// wake up timer thread
wakeup_condition.notifyOne();
}
}
示例3: timer_thread
/**
Stops the timer_thread (called from ~Application()).
@internal
*/
void Timer::stop_timer_thread()
{
Thread* thrd = NULL;
{
ScopedLock hold(timer_mutex);
if (timer_thread == NULL)
return;
thrd = timer_thread;
timer_thread = NULL;
timer_break = true;
wakeup_condition.notifyOne();
}
thrd->join();
delete thrd;
thrd = NULL;
}