Boost logo

Boost Users :

Subject: [Boost-users] [Asio] problem with deadline_timer
From: moffet (moffet_at_[hidden])
Date: 2009-09-28 03:43:18


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 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