本文整理汇总了C++中boost::lockfree::queue::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::pop方法的具体用法?C++ queue::pop怎么用?C++ queue::pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::lockfree::queue
的用法示例。
在下文中一共展示了queue::pop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: consumer
void consumer(void)
{
int value;
while (!done) {
while (queue.pop(value))
++consumer_count;
}
while (queue.pop(value))
++consumer_count;
}
示例2: get_withoutWaiting
// Must NOT be called without first calling wait()
T get_withoutWaiting(){
T ret = 0;
R_ASSERT(queue.pop(ret));
return ret;
}
示例3: consumer
void consumer(void)
{
int value;
//当没有生产完毕,则边消费边生产
while(!done)
{
while(queue.pop(value))
{
cout<<"-"<<endl;
++c_count;
}
}
//如果生产完毕则消费
while(queue.pop(value))
{
++c_count;
}
}
示例4: TRI_AcquireConnectionStatistics
TRI_connection_statistics_t* TRI_AcquireConnectionStatistics () {
TRI_connection_statistics_t* statistics = nullptr;
if (TRI_ENABLE_STATISTICS && ConnectionFreeList.pop(statistics)) {
return statistics;
}
return nullptr;
}
示例5: TRI_AcquireRequestStatistics
TRI_request_statistics_t* TRI_AcquireRequestStatistics () {
TRI_request_statistics_t* statistics = nullptr;
if (TRI_ENABLE_STATISTICS && RequestFreeList.pop(statistics)) {
return statistics;
}
return nullptr;
}
示例6: StatisticsQueueWorker
static void StatisticsQueueWorker (void* data) {
while (! Shutdown && TRI_ENABLE_STATISTICS) {
size_t count = ProcessAllRequestStatistics();
if (count == 0) {
usleep(100 * 1000);
}
else if (count < 10) {
usleep(10 * 1000);
}
else if (count < 100) {
usleep(1 * 1000);
}
}
delete TRI_ConnectionTimeDistributionStatistics;
delete TRI_TotalTimeDistributionStatistics;
delete TRI_RequestTimeDistributionStatistics;
delete TRI_QueueTimeDistributionStatistics;
delete TRI_IoTimeDistributionStatistics;
delete TRI_BytesSentDistributionStatistics;
delete TRI_BytesReceivedDistributionStatistics;
{
TRI_request_statistics_t* entry = nullptr;
while (RequestFreeList.pop(entry)) {
delete entry;
}
}
{
TRI_request_statistics_t* entry = nullptr;
while (RequestFinishedList.pop(entry)) {
delete entry;
}
}
{
TRI_connection_statistics_t* entry = nullptr;
while (ConnectionFreeList.pop(entry)) {
delete entry;
}
}
}
示例7: deallocate
void deallocate(void)
{
for (;;) {
dummy * node;
if (allocated_nodes.pop(node)) {
bool success = working_set.erase(node);
assert(success);
fl.template destruct<true>(node);
}
if (running.load() == false)
break;
}
dummy * node;
while (allocated_nodes.pop(node)) {
bool success = working_set.erase(node);
assert(success);
fl.template destruct<true>(node);
}
}
示例8: ProcessAllRequestStatistics
static size_t ProcessAllRequestStatistics () {
TRI_request_statistics_t* statistics = nullptr;
size_t count = 0;
while (RequestFinishedList.pop(statistics)) {
if (statistics != nullptr) {
ProcessRequestStatistics(statistics);
++count;
}
}
return count;
}
示例9: worker_thread
/*
* The worker_thread blocks in this loop.
* As a member function, it must be binded with this ptr.
*/
void worker_thread() {
for (;;) {
boost::mutex::scoped_lock lock(this->tp_mutex);
cv.wait(lock);
if (work_queue.empty())
continue;
work_t w;
if (work_queue.pop(w))
w->run();
else
thread_run_error();
}
}
示例10: tryGet
// sets success to false if failed, true if succeeded. Return value is undefined if "success" is false.
T tryGet(bool &success){
T ret = 0;
if (ready.tryWait()) {
R_ASSERT(queue.pop(ret));
success = true;
} else {
success = false;
}
return ret;
}
示例11: bConsume
void bConsume(int* x)
{
int y;
bQ.pop(y);
*x = y;
}
示例12: get
void* get()
{
void* r;
if ( stack_.pop(r) ) return r;
return znn_malloc(mem_size_);
}