本文整理汇总了C++中WorkQueue类的典型用法代码示例。如果您正苦于以下问题:C++ WorkQueue类的具体用法?C++ WorkQueue怎么用?C++ WorkQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkQueue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: BamWriterThread
Results BamWriterThread(WorkQueue<Results>& queue, unique_ptr<BamWriter>&& ccsBam,
unique_ptr<PbiBuilder>&& ccsPbi)
{
Results counts;
while (queue.ConsumeWith(WriteBamRecords, ref(*ccsBam), ref(ccsPbi), ref(counts)))
;
return counts;
}
开发者ID:ylipacbio,项目名称:pbccs,代码行数:8,代码来源:ccs.cpp
示例17: blockedWaitForLodGeneration
//--------------------------------------------------------------------------
void MeshLodTests::blockedWaitForLodGeneration(const MeshPtr& mesh)
{
bool success = false;
const int timeout = 5000;
WorkQueue* wq = Root::getSingleton().getWorkQueue();
for (int i = 0; i < timeout; i++)
{
OGRE_THREAD_SLEEP(1);
wq->processResponses(); // Injects the Lod if ready
if (mesh->getNumLodLevels() != 1) {
success = true;
break;
}
}
// timeout
CPPUNIT_ASSERT(success);
}
开发者ID:whztt07,项目名称:ogre3d,代码行数:18,代码来源:MeshLodTests.cpp
示例18: partitionGraph
// store equivalence class in VertexInfo for each vertex
static
vector<VertexInfoSet> partitionGraph(ptr_vector<VertexInfo> &infos,
WorkQueue &work_queue, const NGHolder &g,
EquivalenceType eq) {
const size_t num_verts = infos.size();
vector<VertexInfoSet> classes;
unordered_map<ClassInfo, unsigned> classinfomap;
// assume we will have lots of classes, so we don't waste time resizing
// these structures.
classes.reserve(num_verts);
classinfomap.reserve(num_verts);
// get distances from start (or accept) for all vertices
// only one of them is used at a time, never both
vector<NFAVertexDepth> depths;
vector<NFAVertexRevDepth> rdepths;
if (eq == LEFT_EQUIVALENCE) {
calcDepths(g, depths);
} else {
calcDepths(g, rdepths);
}
// partition the graph based on CharReach
for (VertexInfo &vi : infos) {
ClassInfo::ClassDepth depth;
if (eq == LEFT_EQUIVALENCE) {
depth = depths[vi.vert_index];
} else {
depth = rdepths[vi.vert_index];
}
ClassInfo ci(g, vi, depth, eq);
auto ii = classinfomap.find(ci);
if (ii == classinfomap.end()) {
// vertex is in a new equivalence class by itself.
unsigned eq_class = classes.size();
vi.equivalence_class = eq_class;
classes.push_back({&vi});
classinfomap.emplace(move(ci), eq_class);
} else {
// vertex is added to an existing class.
unsigned eq_class = ii->second;
vi.equivalence_class = eq_class;
classes.at(eq_class).insert(&vi);
// we now know that this particular class has more than one
// vertex, so we add it to the work queue
work_queue.push(eq_class);
}
}
DEBUG_PRINTF("partitioned, %zu equivalence classes\n", classes.size());
return classes;
}
开发者ID:01org,项目名称:hyperscan,代码行数:59,代码来源:ng_equivalence.cpp
示例19: fprintf
void *worker(void *vtp)
{
fprintf(stderr, "Worker working\n");
WorkQueue<Task> *tqp = (WorkQueue<Task> *)vtp;
Task tsk;
for (;;) {
if (!tqp->take(&tsk)) {
fprintf(stderr, "Worker: take failed\n");
return (void*)0;
}
fprintf(stderr, "WORKER: got task %d\n", tsk.m_id);
if (tsk.m_id > 20) {
tqp->workerExit();
break;
}
}
return (void*)1;
}
开发者ID:norandom,项目名称:recoll,代码行数:18,代码来源:workqueue.cpp
示例20:
//---------------------------------------------------------------------
Page::~Page()
{
WorkQueue* wq = Root::getSingleton().getWorkQueue();
wq->removeRequestHandler(mWorkQueueChannel, this);
wq->removeResponseHandler(mWorkQueueChannel, this);
destroyAllContentCollections();
if (mDebugNode)
{
// destroy while we have the chance
SceneNode::ObjectIterator it = mDebugNode->getAttachedObjectIterator();
while(it.hasMoreElements())
mParent->getSceneManager()->destroyMovableObject(it.getNext());
mDebugNode->removeAndDestroyAllChildren();
mParent->getSceneManager()->destroySceneNode(mDebugNode);
mDebugNode = 0;
}
}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:20,代码来源:OgrePage.cpp
注:本文中的WorkQueue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论