void flipQueues(void) { updateQ.fetch_xor(1); /* Clear the update queue afresh. */ queues[updateQ.load()].foreach([](std::shared_ptr<QueueType>& queue) { queue->clear(); }); }
/* Fills out the supplied vector with all the draw queues. * TODO: can I make this better? It seems silly to do this * copy; can I do the draw itself within a foreach()? */ void getDrawQueues(std::vector<std::shared_ptr<QueueType> >& o_drawQueues) { queues[1 - updateQ.load()].foreach([&o_drawQueues](std::shared_ptr<QueueType>& queue) { o_drawQueues.push_back(queue); }); }
void pop(){ while(count.load()){ data data; if(_que.pop(data)){ data.num; } } }
/* Call this when you're an evaluator thread. This method * gives you a pointer to the queue you should use. */ std::shared_ptr<QueueType> getUpdateQueue( unsigned int q) { return queues[updateQ.load()].lengthen(q); }