Boost logo

Boost Users :

Subject: Re: [Boost-users] Valgrind errors with ASIO
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2013-09-30 01:03:51


On 9/30/2013 5:41 PM, Quoth Bo Jensen:
> I have build a job queue with a combination io_service,
> io_service::work, packaged_task and a thread group. I am seeing randomly
> either segfaults or strange asserts in pthread or even malloc, which
> suggest to me memory is being corrupted somehow.
[...]
> I can wait for a job to finish like this :
>
> boost::wait_for_any(io_future_.begin(),io_future_.end());

What are you doing once this has returned?

In particular note that if you want to "give up" on retrieving any
further results then you must stop() the io_service and join_all() the
thread group (in that order) before you allow the io_service or
thread_group to be destroyed. Their respective destructors do not do
this for you.

(Also note that this will of course still complete however many tasks
have already started to process, unless you have some other means of
cancelling a task in progress, such as using interruption points.)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net