|
Boost Users : |
Subject: Re: [Boost-users] ASIO, boost::function in VC7.1
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-25 13:38:21
> Â Â Â Â Â Â m_timer.async_wait(boost::bind(&IntervalEvent::handler, this));
should be: m_timer.async_wait(boost::bind(&IntervalEvent::handler, this, _1));
or:
m_timer.async_wait(boost::bind(&IntervalEvent::handler, this,
boost::asio::placeholders::error));
> Â Â Â void handler(boost::system::error_code& error)
should be: void handler(cosnt boost::system::error_code& error)
> Further to that, I am wondering, in principle should I cancel the deadline_timer on the destructor of the IntervalEvent class? Does the io_service class know when any of the deadline_timers that is being registered goes out of scope?
On destruction, the timer cancels itself anyway.
By the way, you access the timers both from main() and from another
thread - which is illegal, since the asio objects are not thread-safe
(except for io_service).
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