Microtask::Result ActiveDOMCallbackMicrotask::run()
{
    if (!canInvokeCallback())
        return Result::KeepInQueue;

    m_task();
    return Result::Done;
}
Beispiel #2
0
	void ImageDataWriteThread::runTask()
	{
		assert(m_task != nullptr); //必须预设好task

		while(1)
		{
			auto data = getData4Read();
			if(data.buffer == nullptr)
				break;
			
			m_task(data);

			putData4Write(data);
		}
	}
Beispiel #3
0
void DeferredTask::Routine::Do()
{
  mutex mu;
  unique_lock<mutex> lock(mu);

  steady_clock::time_point const end = steady_clock::now() + m_delay;
  while (!IsCancelled())
  {
    steady_clock::time_point const current = steady_clock::now();
    if (current >= end)
      break;
    m_cv.wait_for(lock, end - current, [this]()
    {
      return IsCancelled();
    });
  }

  if (!IsCancelled())
  {
    m_started = true;
    m_task();
  }
}
Beispiel #4
0
 // WebScheduler::IdleTask implementation.
 void run(double deadlineSeconds) override
 {
     m_task(deadlineSeconds);
 }