Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio] problem with deadline_timer
From: Casimiro, Daniel C CIV NUWC NWPT (daniel.casimiro_at_[hidden])
Date: 2009-09-28 09:30:16


The timer event is in the ASIO queue when your "stop" handler is called. Check the return value of "timer.cancel()" to determine if the timer was actually cancelled.

If "timer.cancel()" returns zero, the timer already fired.

~Dan

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of moffet
> Sent: Monday, September 28, 2009 3:43
> To: boost-users_at_[hidden]
> Subject: [Boost-users] [Asio] problem with deadline_timer
>
> This is a small program using deadline_timer with expiration
> time 1 millisecond.
> http://snipt.org/nKm
> When I run it over and over it will evantually stuck lie this:
> http://img39.imageshack.us/img39/1292/handh.jpg
> and I don't know why.
>
> The io_service.run() is started in another thread.
> The main thread is waiting for pressing 'any key', the I call
> post() method to cancel() the timer.
> But sometimes as you can see on the screenshot, cancel() is
> invoked, but the timer continues to run.
> It seems that run() method doesn't invoke the timer handler
> with boost::asio::error::operation_aborted error.
> I've noticed this effect will be encouraged by high CPU usage.
>
> Vista 64bit, VC++ 2008 Express, Boost 1.40.0
>
> Why this is happening?
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>




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