本文整理汇总了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();
}
示例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();
}
示例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);
}
示例4:
virtual ~Log()
{
_isStopping = true;
_threadPool.interrupt_all();
_threadPool.join_all();
_stringLoggerThread.interrupt();
_stringLoggerThread.join();
}
示例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);
}
示例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);
}
示例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&) {}
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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__;
}
示例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;
}
示例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();
}
示例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;
}