boost 同步定时器

 1 #include <iostream>
 2 #include <boost/asio.hpp>
 3 #include <boost/date_time/posix_time/posix_time.hpp>
 4 using namespace boost::asio;
 5 int main()
 6 {
 7     io_service ios;
 8     deadline_timer t(ios,boost::posix_time::seconds(2));
 9     std::cout<<t.expires_at()<<std::endl;
10     t.wait();
11     std::cout<<"hello asio"<<std::endl;
12     
13 }

 

posted @ 2013-06-20 17:35  星语160523  阅读(410)  评论(0编辑  收藏  举报