Boost中timer的简易用法
2013-06-25 15:50
330 查看
boost::asio::deadline_timer timer_;
timer_(io_service),
timer_.expires_from_now(boost::posix_time::seconds(1));
timer_.async_wait(
boost::bind(&sender::handle_timeout, this,
boost::asio::placeholders::error));
void handle_timeout(const boost::system::error_code& error)
{
if (!error)
{
timer_.expires_from_now(boost::posix_time::seconds(1));
timer_.async_wait(
boost::bind(&sender::handle_timeout, this,
boost::asio::placeholders::error));
/*Insert Your Functions*/
}
}
在你所用的类中声明一个boost 的timer 见第一句话,
初始化这个timer 第二句话,
第三句,第四句话,使timer正常的工作起来。
后面的的timer的时间到后,的执行程序。
执行程序中,进行了迭代,可以再次计时,
相关文章推荐
- Boost中timer的简易用法
- 【Boost】boost::timer库用法与实例
- boost::asio::steady_timer的一个错误用法
- 【Boost】boost::timer库用法与实例
- 让窗体飘动起来--C#中Timer组件用法
- Boost--时间和日期--(1)timer库的介绍
- boost 中round和roundf函数的用法
- boost.asio系列——Timer
- boost shared_ptr 用法
- boost-timer
- Boost学习之Timer库
- boost多线程简单用法
- boost bind 用法
- boost::share_ptr用法
- boost::thread用法
- Boost Timer 计时器
- java定时器——Timer的用法(转)
- windows下boost开发环境简易教程(cygwin+eclipse)
- boost完全开发指南第2章-处理时间2(时间类timer)
- java.util.Timer用法须知