Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] multi-threaded io_service::run produce wrong result
From: leiming (lmforreg_at_[hidden])
Date: 2011-03-30 11:28:07


ÔÚ Wed, 30 Mar 2011 05:56:39 +0800£¬Lars Viklund <zao_at_[hidden]> дµÀ:

> On Tue, Mar 29, 2011 at 06:49:12AM +0800, leiming wrote:
>
> I do not quite know why, but I would guess that once an io_service has
> gone into the stopped state, you might have to perform some action to
> reset it, so that it can be started again. I would not expect any
> actions you post to it during the stopped-but-not-reset period to
> have any effect.
>
Oh, I try running ioserv.reset(); ioserv.run(); after the two joins
and this time it works as I excepted.
Thank you very much.

By the way, I see this statement in boost::asio::io_service::reset
document:

This function must be called prior to any second or later set of
invocations of the run(), run_one(), poll() or poll_one() functions when a
previous invocation of these functions returned due to the io_service
being stopped or running out of work.

I didn't notice this before... orz

>
> Hooray!


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