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


C++ thread_group::join_all方法代码示例

本文整理汇总了C++中boost::thread_group::join_all方法的典型用法代码示例。如果您正苦于以下问题:C++ thread_group::join_all方法的具体用法?C++ thread_group::join_all怎么用?C++ thread_group::join_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::thread_group的用法示例。


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

示例1: fl

 freelist_tester(void):
     free_nodes(0), fl(max_nodes * thread_count)
 {
     for (int i = 0; i != thread_count; ++i)
         threads.create_thread(boost::bind(&freelist_tester::run, this));
     threads.join_all();
 }
开发者ID:mandy-nan,项目名称:EECS570,代码行数:7,代码来源:freelist_test.cpp

示例2: serverMake

 void serverMake(int port, std::string address) {
     server serv(*io_service_, port, address);
   for(int i=0;i<5;i++) {
       threads->create_thread(boost::bind(getstart,io_service_));
   }
     threads->join_all();
 }
开发者ID:nikitaband1t,项目名称:finalProject,代码行数:7,代码来源:main.cpp

示例3:

    ~TestingSetup()
    {
        threadGroup.interrupt_all();
        threadGroup.join_all();
        Bitcredit_UnregisterNodeSignals(Credits_NetParams()->GetNodeSignals());
#ifdef ENABLE_WALLET
        delete bitcoin_pwalletMain;
        bitcoin_pwalletMain = NULL;
        delete bitcredit_pwalletMain;
        bitcredit_pwalletMain = NULL;
        delete deposit_pwalletMain;
        deposit_pwalletMain = NULL;
#endif
        delete credits_pcoinsTip;
        delete bitcredit_pcoinsdbview;
        delete bitcredit_pblocktree;

        delete bitcoin_pcoinsTip;
        delete bitcoin_pcoinsdbview;
        delete bitcoin_pblocktree;
#ifdef ENABLE_WALLET
        bitcoin_bitdb.Flush(true);
        bitcredit_bitdb.Flush(true);
        deposit_bitdb.Flush(true);
#endif
        boost::filesystem::remove_all(pathTemp);
    }
开发者ID:credits-currency,项目名称:credits,代码行数:27,代码来源:test_credits.cpp

示例4:

 virtual ~Log()
 {
     _isStopping = true;
     _threadPool.interrupt_all();
     _threadPool.join_all();
     _stringLoggerThread.interrupt();
     _stringLoggerThread.join();
 }
开发者ID:ankithbti,项目名称:fitiedCoreCpp,代码行数:8,代码来源:Log.hpp

示例5: deinit

// Sets that the program should finish.
void deinit()
{
	programRunning = FALSE;
#if _USE_MT
	threads.join_all();
#endif

	_aligned_free(spherePositions);
	_aligned_free(sphereData);
}
开发者ID:astrellon,项目名称:GPP,代码行数:11,代码来源:main.cpp

示例6:

 ~TestingSetup()
 {
     threadGroup.interrupt_all();
     threadGroup.join_all();
     delete pwalletMain;
     pwalletMain = NULL;
     delete pcoinsTip;
     delete pcoinsdbview;
     delete pblocktree;
     bitdb.Flush(true);
     boost::filesystem::remove_all(pathTemp);
 }
开发者ID:ColoradoPay,项目名称:CPAY,代码行数:12,代码来源:test_bitcoin.cpp

示例7: lock

    /// @brief Destructor.
    ~ThreadPool() {
        // Set running flag to false then notify all threads.
        {
            boost::unique_lock< boost::mutex > lock(mutex_);
            running_ = false;
            condition_.notify_all();
        }

        try {
            threads_.join_all();
        }
        // Suppress all exceptions.
        catch (const std::exception&) {}
    }
开发者ID:Caffe-MPI,项目名称:Caffe-MPI.github.io,代码行数:15,代码来源:thread_pool.hpp

示例8: stop

	void stop()
	{
      std::cout << "main pool thread sending quit job."
            << std::endl;

      job::smart_ptr q(new quit());
      const typename threads_type::iterator i_end = my_threads.end();
      for (typename threads_type::iterator i = my_threads.begin(); i != i_end; ++i)
         (*i)->push(q);
      std::cout << "main pool thread waiting for children to terminate."
            << std::endl;
      my_group.join_all();
      static nyan::deletes< thread_type > f;
      std::for_each(my_threads.begin(), my_threads.end(), f);
	}
开发者ID:fmrl,项目名称:blanchett,代码行数:15,代码来源:pool.hpp

示例9: run_test

void client::run_test()
{
	unsigned optimal_threads_count = boost::thread::hardware_concurrency();

	if (optimal_threads_count == 0)
		optimal_threads_count = 1;

	ostream_ << "Create " << optimal_threads_count << " threads for client" << std::endl;

	for (unsigned i = 0; i < optimal_threads_count; ++i)
		threads_.add_thread(new boost::thread([this, i] () { thread_func(i); }));

	threads_.join_all();
	ostream_ << "All client's threads done" << std::endl;
}
开发者ID:sfff,项目名称:example,代码行数:15,代码来源:example.cpp

示例10: stop

void AsyncSpinnerImpl::stop()
{
  boost::mutex::scoped_lock lock(mutex_);
  if (!continue_)
    return;

  ROS_ASSERT_MSG(member_spinlock.owns_lock(), 
                 "Async spinner's member lock doesn't own the global spinlock, hrm.");
  ROS_ASSERT_MSG(member_spinlock.mutex() == &spinmutex, 
                 "Async spinner's member lock owns a lock on the wrong mutex?!?!?");
  member_spinlock.unlock();

  continue_ = false;
  threads_.join_all();
}
开发者ID:strawlab,项目名称:ros_comm,代码行数:15,代码来源:spinner.cpp

示例11: UnregisterNodeSignals

    ~TestingSetup()
    {
        threadGroup.interrupt_all();
        threadGroup.join_all();
        UnregisterNodeSignals(GetNodeSignals());
#ifdef ENABLE_WALLET
        delete pwalletMain;
        pwalletMain = NULL;
#endif
        delete pblocktree;
	delete pviewTip;
#ifdef ENABLE_WALLET
        bitdb.Flush(true);
#endif
        boost::filesystem::remove_all(pathTemp);
    }
开发者ID:JacobBruce,项目名称:Cryptonite,代码行数:16,代码来源:test_bitcoin.cpp

示例12: DLOG

   ~thread_pool()
   {
      DLOG(INFO) << "stopping service...";
      // Force all threads to return from io_service::run().
      io_service_.stop();

      DLOG(INFO) << "joining threads...";
      try
      {
         threads_.join_all();
      }
      catch (...)
      {
         LOG_EXCEPTION();
      }
      DLOG(INFO) << __func__;
   }
开发者ID:murzz,项目名称:stuff,代码行数:17,代码来源:main.cpp

示例13: main

int main(int argc, char** argv) {
    init();
    if (handle_args(argc, argv) == 1)
        return 0;

    int processors = boost::thread::hardware_concurrency();

    ioService.post(boost::bind(read_images));
    ioService.post(boost::bind(assign_workers));
    ioService.post(boost::bind(output));

    boost::asio::io_service::work work(ioService);
    for (int i = 0; i < processors; i++) {
        threadpool.create_thread(boost::bind(&boost::asio::io_service::run, &ioService));
    }
    threadpool.join_all();
    return 0;
}
开发者ID:h397wang,项目名称:computer-vision,代码行数:18,代码来源:main.cpp

示例14: main

int main()
{
  {
    boost::thread_group threads;
    for (int i = 0; i < 3; ++i)
        threads.create_thread(&increment_count);
    threads.join_all();
  }
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
  {
    boost::thread_group threads;
    for (int i = 0; i < 3; ++i)
        threads.create_thread(&increment_count);
    threads.interrupt_all();
    threads.join_all();
  }
#endif
  {
    boost::thread_group threads;
    boost::thread* th = new boost::thread(&increment_count);
    threads.add_thread(th);
    BOOST_TEST(! threads.is_this_thread_in());
    threads.join_all();
  }
  {
    boost::thread_group threads;
    boost::thread* th = new boost::thread(&increment_count);
    threads.add_thread(th);
    BOOST_TEST(threads.is_thread_in(th));
    threads.remove_thread(th);
    BOOST_TEST(! threads.is_thread_in(th));
    th->join();
  }
  {
    {
      boost::unique_lock<boost::mutex> lock(mutex);
      boost::thread* th2 = new boost::thread(&increment_count_2);
      threads2.add_thread(th2);
    }
    threads2.join_all();
  }
  return boost::report_errors();
}
开发者ID:MisterTea,项目名称:MAMEHub,代码行数:43,代码来源:thread_group.cpp

示例15: main

int main()
{
    std::ifstream input(BINARY_DIR"/input.txt", std::ios::binary);
    SyncClass sc;
    for(int i = 0;i < THREADS_COUNT; i++)
        threads.create_thread(boost::bind(&SyncClass::writeMessage, &sc) );

    while(!input.eof()){
        Message msg(input);
        if(input.eof())
            break;
        boost::mutex::scoped_lock lock(queueMutex);
        msgQueue.push(msg);
    }
    sc.stopWorking();
    threads.join_all();

    return 0;
}
开发者ID:Gedeon-by,项目名称:cpp_craft_0314,代码行数:19,代码来源:binary_datafeed.cpp


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