boost库中sleep有两个方法:
1. 这个方法只能在线程中用, 在主线程中用无效.
原型:
实例:
2. 在主线程中使用
原型:
实例:
1. 这个方法只能在线程中用, 在主线程中用无效.
原型:
- void sleep(TimeDuration const& rel_time);
- void sleep(system_time const& abs_time);
- boost::this_thread::sleep(boost::posix_time::seconds(2)); // 这种更好用
- boost::this_thread::sleep(boost::get_system_time() + boost::posix_time::seconds(2));
原型:
- sleep(const system_time& xt);
- boost::thread::sleep(boost::get_system_time() + boost::posix_time::seconds(5));