在 Wed, 30 Mar 2011 05:56:39 +0800,Lars Viklund
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!