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


C++ WorkQueue类代码示例

本文整理汇总了C++中WorkQueue的典型用法代码示例。如果您正苦于以下问题:C++ WorkQueue类的具体用法?C++ WorkQueue怎么用?C++ WorkQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: main

int main()
{
    WorkQueue q;
    work_t w = work_t(1, 2, 3, 4);
    q.add(w);
    assert(q.get().bot_y == w.bot_y);
    assert(q.get().id == 0);
    assert(q.remove(0).bot_y == w.bot_y);

    return 0;
}
开发者ID:TheiaRT,项目名称:tracer,代码行数:11,代码来源:work_test.cpp

示例2: ASSERT_ARG

DWORD WorkQueue::workThreadCallback(void* context)
{
    ASSERT_ARG(context, context);

    WorkQueue* queue = static_cast<WorkQueue*>(context);

    if (!queue->tryRegisterAsWorkThread())
        return 0;

    queue->performWorkOnRegisteredWorkThread();
    return 0;
}
开发者ID:gubaojian,项目名称:trylearn,代码行数:12,代码来源:WorkQueueWin.cpp

示例3: printWorkQueue

void printWorkQueue(WorkQueue& queue) {
  WorkQueue local_queue(queue);
  printf("WorkQueue: %d elements\n", queue.size());
  for (long unsigned int request_index = 0;
          request_index < queue.size();
          ++request_index) {
    WorkRequest req = local_queue.top();
    local_queue.pop();
    printf("queue[%d]: node_index: %d, time_diff: %f\n", request_index,
            req.getIndex(), req.getTimeDiff());
  }
}
开发者ID:DonnieNewell,项目名称:hulkdeer,代码行数:12,代码来源:Node.cpp

示例4: mID

	//---------------------------------------------------------------------
	Page::Page(PageID pageID, PagedWorldSection* parent)
		: mID(pageID)
		, mParent(parent)
		, mDeferredProcessInProgress(false)
		, mModified(false)
		, mDebugNode(0)
	{
		WorkQueue* wq = Root::getSingleton().getWorkQueue();
		mWorkQueueChannel = wq->getChannel("Ogre/Page");
		wq->addRequestHandler(mWorkQueueChannel, this);
		wq->addResponseHandler(mWorkQueueChannel, this);
		touch();
	}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:14,代码来源:OgrePage.cpp

示例5: renderFinished

void Scheduler::renderFinished(WorkItem* item)
{
   WorkQueue* temp = priorityList.first();
   bool containsItem = false;
   if(item)
   {
      while((temp)&&(!containsItem))
      {
         containsItem = temp->renderFinished(item);
         temp = priorityList.next();
      }
   }
}
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:13,代码来源:scheduler.cpp

示例6: Component

Octree::Octree(Context* context) :
    Component(context),
    Octant(BoundingBox(-DEFAULT_OCTREE_SIZE, DEFAULT_OCTREE_SIZE), 0, 0, this),
    numLevels_(DEFAULT_OCTREE_LEVELS)
{
    // Resize threaded ray query intermediate result vector according to number of worker threads
    WorkQueue* workQueue = GetSubsystem<WorkQueue>();
    rayQueryResults_.Resize(workQueue ? workQueue->GetNumThreads() + 1 : 1);

    // If the engine is running headless, subscribe to RenderUpdate events for manually updating the octree
    // to allow raycasts and animation update
    if (!GetSubsystem<Graphics>())
        SubscribeToEvent(E_RENDERUPDATE, HANDLER(Octree, HandleRenderUpdate));
}
开发者ID:julyfortoday,项目名称:Urho3D,代码行数:14,代码来源:Octree.cpp

示例7: data

	//------------------------------------------------------------------------
	BackgroundProcessTicket ResourceBackgroundQueue::addRequest(ResourceRequest& req)
	{
		WorkQueue* queue = Root::getSingleton().getWorkQueue();

		Any data(req);

		WorkQueue::RequestID requestID = 
			queue->addRequest(mWorkQueueChannel, (uint16)req.type, data);


		mOutstandingRequestSet.insert(requestID);

		return requestID;
	}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:15,代码来源:OgreResourceBackgroundQueue.cpp

示例8: TEST

TEST(WorkQueue, cancel) {
    RunLoop loop(uv_default_loop());

    WorkQueue queue;

    auto work = [&]() {
        FAIL() << "Should never be called";
    };

    queue.push(work);
    queue.push(work);
    queue.push(work);
    queue.push(work);
    queue.push(work);
}
开发者ID:MaxGraey,项目名称:mapbox-gl-native,代码行数:15,代码来源:work_queue.cpp

示例9: workitems

void MethodTransform::sync_all() {
  std::vector<MethodTransform*> transforms;
  for (auto& centry : s_cache) {
    transforms.push_back(centry.second);
  }
  std::vector<WorkItem<MethodTransform>> workitems(transforms.size());
  auto mt_sync = [](MethodTransform* mt) { mt->sync(); };
  for (size_t i = 0; i < transforms.size(); i++) {
    workitems[i].init(mt_sync, transforms[i]);
  }
  WorkQueue wq;

  if (workitems.size() > 0) {
    wq.run_work_items(&workitems[0], (int)workitems.size());
  }
}
开发者ID:kleopatra999,项目名称:redex,代码行数:16,代码来源:Transform.cpp

示例10: lk

    StatusWith<ReplicationExecutor::CallbackHandle> ReplicationExecutor::scheduleWorkAt(
            Date_t when,
            const CallbackFn& work) {

        boost::lock_guard<boost::mutex> lk(_mutex);
        WorkQueue temp;
        StatusWith<CallbackHandle> cbHandle = enqueueWork_inlock(&temp, work);
        if (!cbHandle.isOK())
            return cbHandle;
        cbHandle.getValue()._iter->readyDate = when;
        WorkQueue::iterator insertBefore = _sleepersQueue.begin();
        while (insertBefore != _sleepersQueue.end() && insertBefore->readyDate <= when)
            ++insertBefore;
        _sleepersQueue.splice(insertBefore, temp, temp.begin());
        return cbHandle;
    }
开发者ID:Aaron20141021,项目名称:mongo,代码行数:16,代码来源:replication_executor.cpp

示例11: test_work_queue

void test_work_queue() {
  WorkQueue<string> q;
  string t = "hello";
  q.push(t);
  string s;
  if(q.try_pop(s, 500)){
    cout << "got " << s << " from queue" << endl;
  }
  bool ok = q.try_pop(s,500);
  if(ok) {
    cout << "failed, should have timed out" << endl;
  }
  else{
    cout << "passed, timed out as expected" << endl;
  }
}
开发者ID:berickson,项目名称:car,代码行数:16,代码来源:work_queue.cpp

示例12: didCloseOnConnectionWorkQueue

static void didCloseOnConnectionWorkQueue(WorkQueue& workQueue, CoreIPC::Connection*)
{
    // If the connection has been closed and we haven't responded in the main thread for 10 seconds
    // the process will exit forcibly.
    const double watchdogDelay = 10;

    workQueue.dispatchAfterDelay(bind(static_cast<void(*)()>(watchdogCallback)), watchdogDelay);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例13: didCloseOnConnectionWorkQueue

void ChildProcess::didCloseOnConnectionWorkQueue(WorkQueue& workQueue, CoreIPC::Connection*)
{
    // If the connection has been closed and we haven't responded in the main thread for 10 seconds
    // the process will exit forcibly.
    static const double watchdogDelay = 10.0;
    
    workQueue.scheduleWorkAfterDelay(WorkItem::create(watchdogCallback), watchdogDelay);
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:8,代码来源:ChildProcess.cpp

示例14: PagedWorldSection

    //---------------------------------------------------------------------
    TerrainPagedWorldSection::TerrainPagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm)
        : PagedWorldSection(name, parent, sm)
        , mTerrainGroup(0)
        , mTerrainDefiner(0)
        , mHasRunningTasks(false)
        , mLoadingIntervalMs(900)
    {
        // we always use a grid strategy
        setStrategy(parent->getManager()->getStrategy("Grid2D"));

        WorkQueue* wq = Root::getSingleton().getWorkQueue();
        mWorkQueueChannel = wq->getChannel("Ogre/TerrainPagedWorldSection");
        wq->addRequestHandler(mWorkQueueChannel, this);
        wq->addResponseHandler(mWorkQueueChannel, this);

        mNextLoadingTime = Root::getSingletonPtr()->getTimer()->getMilliseconds();
    }
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:18,代码来源:OgreTerrainPagedWorldSection.cpp

示例15: FastqWriterThread

Results FastqWriterThread(WorkQueue<Results>& queue, const string& fname)
{
    ofstream ccsFastq(fname);
    Results counts;
    while (queue.ConsumeWith(WriteFastqRecords, ref(ccsFastq), ref(counts)))
        ;
    return counts;
}
开发者ID:ylipacbio,项目名称:pbccs,代码行数:8,代码来源:ccs.cpp


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