Boost logo

Boost Users :

Subject: Re: [Boost-users] async processing issues
From: Igor R (boost.lists_at_[hidden])
Date: 2013-07-03 02:00:03


See my comments below.

> // dir_monitor thread
> boost::thread mthread =
> boost::thread(boost::bind(&boost::asio::io_service::run,
> boost::ref(io_service)));
>
> // setup work to prevent premature exit
> shared_ptr<boost::asio::io_service::work>
> work(new boost::asio::io_service::work(work_service));

Set "work" *before* running io_service, otherwise io_service::run
might already have exited at this point, because it's out of work.

> while (true) {
> io_service.reset();

I'm not sure what this loop is for, but why do you reset io_service?
It will stop working. Please, read manual:
http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/io_service/reset.html


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