当前位置: 首页>>代码示例>>C++>>正文


C++ ConditionVariable::notifyOne方法代码示例

本文整理汇总了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
	}
开发者ID:ezhangle,项目名称:anki-3d-engine,代码行数:9,代码来源:Thread.cpp

示例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();
  }
}
开发者ID:Jmos,项目名称:vaca,代码行数:27,代码来源:Timer.cpp

示例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;
}
开发者ID:Jmos,项目名称:vaca,代码行数:27,代码来源:Timer.cpp


注:本文中的ConditionVariable::notifyOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。