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


C++ Task::complete方法代码示例

本文整理汇总了C++中Task::complete方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::complete方法的具体用法?C++ Task::complete怎么用?C++ Task::complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task的用法示例。


在下文中一共展示了Task::complete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: closeFileCallback

  static void closeFileCallback(uv_fs_t* handle)
  {
    Task* task = static_cast<Task*>(handle->data);

    // Close returns nothing.
    task->complete(NULL);
  }
开发者ID:DawidvC,项目名称:magpie,代码行数:7,代码来源:IO.cpp

示例2: run

  void TaskSchedulerSys::run(size_t threadIndex, size_t threadCount)
  {
    while (true)
    {      
      /* wait for available task */
      mutex.lock();
      while ((end-begin) == 0 && !terminateThreads) {
        condition.wait(mutex); continue;
      }
      
      /* terminate this thread */
      if (terminateThreads) {
        mutex.unlock(); return;
      }

      /* take next task from stack */
      size_t i = (end-1)&(tasks.size()-1);
      Task* task = tasks[i]; 
      size_t elt = --task->started;
      if (elt == 0) end--;
      mutex.unlock();
      
      /* run the task */
      TaskScheduler::Event* event = task->event;
      thread2event[threadIndex] = event; 
      if (task->run) task->run(task->runData,threadIndex,threadCount,elt,task->elts,task->event);
      
      /* complete the task */
      if (--task->completed == 0) {
        if (task->complete) task->complete(task->completeData,threadIndex,threadCount,task->event);
        if (event) event->dec();
      } 
    }
  }
开发者ID:1510649869,项目名称:tungsten,代码行数:34,代码来源:taskscheduler_sys.cpp

示例3: openFileCallback

  static void openFileCallback(uv_fs_t* handle)
  {
    // TODO(bob): Handle errors!
    Task* task = static_cast<Task*>(handle->data);

    // Note that the file descriptor is returned in [result] and not [file].
    task->complete(new FileObject(handle->result));
  }
开发者ID:DawidvC,项目名称:magpie,代码行数:8,代码来源:IO.cpp

示例4: getSizeCallback

 static void getSizeCallback(uv_fs_t* handle)
 {
   // TODO(bob): Handle errors!
   Task* task = static_cast<Task*>(handle->data);
   // TODO(bob): Use handle.statbuf after upgrading to latest libuv where
   // that's public.
   uv_statbuf_t* statbuf = static_cast<uv_statbuf_t*>(handle->ptr);
   task->complete(new IntObject(statbuf->st_size));
 }
开发者ID:DawidvC,项目名称:magpie,代码行数:9,代码来源:IO.cpp

示例5: work

 void TaskSchedulerSys::work(size_t threadIndex, size_t threadCount, bool wait)
 {
   /* wait for available task */
   mutex.lock();
   while ((end-begin) == 0 && !terminateThreads) {
     if (wait) condition.wait(mutex);
     else { mutex.unlock(); return; }
   }
   
   /* terminate this thread */
   if (terminateThreads) {
     mutex.unlock();
     throw TaskScheduler::Terminate();
   }
   
   /* take next task from stack */
   size_t i = (end-1)&(tasks.size()-1);
   Task* task = tasks[i]; 
   size_t elt = --task->started;
   if (elt == 0) end--;
   mutex.unlock();
   
   /* run the task */
   TaskScheduler::Event* event = task->event;
   thread2event[threadIndex].event = event; 
   if (task->run) {
     size_t taskID = TaskLogger::beginTask(threadIndex,task->name,elt);
     task->run(task->runData,threadIndex,threadCount,elt,task->elts,task->event);
     TaskLogger::endTask(threadIndex,taskID);
   }
   
   /* complete the task */
   if (--task->completed == 0) {
     if (task->complete) {
       size_t taskID = TaskLogger::beginTask(threadIndex,task->name,0);
       task->complete(task->completeData,threadIndex,threadCount,task->event);
       TaskLogger::endTask(threadIndex,taskID);
     }
     if (event) event->dec();
   }
 }
开发者ID:cpaalman,项目名称:embree,代码行数:41,代码来源:taskscheduler_sys.cpp


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