SIGABRT problem in boost thread_group

I am having problems with boost :: thread_group

boost::asio::io_service ioService;
boost::thread_group threadpool;

boost::asio::io_service::work work(ioService);


for (int i = 0; i  < num_threads; i++) {
    threadpool.create_thread(boost::bind(&boost::asio::io_service::run, &ioService));
}

boost::thread *t_proxy = 0;

if (!without_proxy)
{
    t_proxy = new boost::thread(boost::bind(&ThreadPool::w_proxy, this, proxy_link));
}


int task_size = tasks.size();
for (int i = 0; i < task_size; i++) {
    boost::mutex::scoped_lock lock(_mutex);
    working_threads++;

    ioService.post(boost::bind(&ThreadPool::thread_worker, this));
    tasks.pop_front();


ioService.stop();


if (t_proxy)
{
    t_proxy->join();
}

threadpool.join_all();

      

&ThreadPool::w_proxy

- a thread that checks the proxy in the background and saves it to the general list &ThreadPool::thread_worker

- a working function that uses the proxy from the general list and performs some functions a task vector with a task list _mutex

- boost :: mutex is used for the sync proxy list and result thread_worker

fault point: in the process I got a SIGABRT in the line t_proxy-> Join (); or in threadpool.join_all ();

I tried adding w_proxy to the shared thread_group and I have the same issue threadpool.join_all ();

I have a traceback in condition_variable.hpp
Failed function condition_variable::wait

in line

res = pthread_cond_wait(&cond,&internal_mutex);

      

could you help me?

+3


source to share





All Articles