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


C++ queue::pop方法代码示例

本文整理汇总了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;
}
开发者ID:softarts,项目名称:test,代码行数:11,代码来源:boostthread.cpp

示例2: get_withoutWaiting

  // Must NOT be called without first calling wait()
  T get_withoutWaiting(){
    T ret = 0;
    
    R_ASSERT(queue.pop(ret));

    return ret;
  }
开发者ID:dieface,项目名称:radium-1,代码行数:8,代码来源:Queue.hpp

示例3: consumer

void consumer(void)
{
    int value;
    //当没有生产完毕,则边消费边生产
    while(!done)
    {
        while(queue.pop(value))
        {
            cout<<"-"<<endl;
            ++c_count;
        }
    }
    //如果生产完毕则消费
    while(queue.pop(value))
    {
        ++c_count;
    }
}
开发者ID:chijinxina,项目名称:Boost-Learning,代码行数:18,代码来源:lockfree_queue.cpp

示例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;
}
开发者ID:CedarLogic,项目名称:arangodb,代码行数:9,代码来源:statistics.cpp

示例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;
}
开发者ID:CedarLogic,项目名称:arangodb,代码行数:9,代码来源:statistics.cpp

示例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;
    }
  }
}
开发者ID:CedarLogic,项目名称:arangodb,代码行数:44,代码来源:statistics.cpp

示例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);
        }
    }
开发者ID:mokerjoke,项目名称:boost-svn,代码行数:21,代码来源:freelist_test.cpp

示例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;
}
开发者ID:CedarLogic,项目名称:arangodb,代码行数:13,代码来源:statistics.cpp

示例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();
        }

    }
开发者ID:SevenHe,项目名称:Linux,代码行数:19,代码来源:ftp_class.hpp

示例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;
  }
开发者ID:dieface,项目名称:radium-1,代码行数:18,代码来源:Queue.hpp

示例11: bConsume

void bConsume(int* x)
{
    int y;
    bQ.pop(y);
    *x = y;
}
开发者ID:peterhuszti,项目名称:LockFreeQueue,代码行数:6,代码来源:main.cpp

示例12: get

 void* get()
 {
     void* r;
     if ( stack_.pop(r) ) return r;
     return znn_malloc(mem_size_);
 }
开发者ID:Nuzhny007,项目名称:znn-release,代码行数:6,代码来源:lockfree_cube_pool.hpp


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