28 Mar
2011
28 Mar
'11
6:40 p.m.
On Mon, Mar 28, 2011 at 08:40:02PM +0800, leiming wrote:
Hi, there.
An io_service will consider itself finished when there is no more pending tasks to perform. That means that if there is sufficient time between the first task and the second task being posted, they may return from run() and end their threads, resulting in the joins being completed. If you want to keep an io_service alive while there are no pending operations, construct an io_service::work object from the io_service. That will keep io_service::run() running until all pending work is finished (which you will indicate by destroying the work object. -- Lars Viklund | zao@acc.umu.se