int main() { typedef boost::csbl::vector<boost::thread> thread_vector; { thread_vector threads; threads.reserve(10); for (int i = 0; i < 10; ++i) { boost::thread th(&increment_count); threads.push_back(boost::move(th)); } join_all(threads); } count = 0; { thread_vector threads; threads.reserve(10); for (int i = 0; i < 10; ++i) { threads.push_back(BOOST_THREAD_MAKE_RV_REF(boost::thread(&increment_count))); } join_all(threads); } count = 0; { thread_vector threads; threads.reserve(10); for (int i = 0; i < 10; ++i) { threads.emplace_back(&increment_count); } join_all(threads); } count = 0; { thread_vector threads; threads.reserve(10); for (int i = 0; i < 10; ++i) { threads.emplace_back(&increment_count); } interrupt_all(threads); join_all(threads); } return boost::report_errors(); }
threaded_listener::~threaded_listener() { try { finish(); join_all(); } catch (std::exception const &e) { (void) e; } }
void ThreadPool::set_num_threads(int num) { if(num >= 0) { try { join_all(); for(int i = 0; i < num; ++i) { m_impl->threads.push_back(std::thread(boost::bind(&boost::asio::io_service::run, &m_impl->io_service))); } } catch(std::exception &e){LOG_ERROR<<e.what();} } }
int constructor_search(bool isok, t_line *l) { char *full_str; char *new_search; new_search = ft_strjoin(l->search, "_"); if (new_search == NULL) return (1); full_str = join_all(l, new_search, isok); ft_strdel(&new_search); if (full_str == NULL) return (1); l->str = full_str; l->final_count = ft_strlen(l->ans); l->size = ft_strlen(l->ans); return (0); }
inline ~ThreadGroup() { join_all(); }
ThreadPool::~ThreadPool() { m_impl->io_service.stop(); join_all(); }
~ThreadPool() {notify("ThreadPool destructor, idx=",idx); join_all();} //{join_rest_cond();}
/// destructor ~fiber_group() { join_all(); for(std::list<fiber*>::iterator it=fibers_.begin(), end=fibers_.end(); it!=end; ++it) { delete *it; } }
void DbWorkerPool::waitAll() { join_all(); }