一.同步定时器,如下:
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main(int argc,char** argv){
boost::asio::io_service ios;
boost::asio::deadline_timert(ios,boost::posix_time::seconds(2));
std::cout<<t.expires_at()<<std::endl;
t.wait();
std::cout<<"helloworld"<<std::endl;
return 0;
}
二.异步定时器,如下:
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
void print(const boost::system: