Esempio n. 1
0
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();
}
Esempio n. 2
0
threaded_listener::~threaded_listener() {
    try {
        finish();
        join_all();
    }
    catch (std::exception const &e) {
        (void) e;
    }
}
Esempio n. 3
0
 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();}
     }
 }
Esempio n. 4
0
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);
}
Esempio n. 5
0
 inline ~ThreadGroup() { join_all(); }
Esempio n. 6
0
 ThreadPool::~ThreadPool()
 {
     m_impl->io_service.stop();
     join_all();
 }
	~ThreadPool() {notify("ThreadPool destructor, idx=",idx); join_all();} //{join_rest_cond();}
Esempio n. 8
0
 /// destructor
 ~fiber_group() {
     join_all();
     for(std::list<fiber*>::iterator it=fibers_.begin(), end=fibers_.end(); it!=end; ++it) {
         delete *it;
     }
 }
Esempio n. 9
0
void DbWorkerPool::waitAll()
{
    join_all();
}