
Boris <boriss@web.de> writes:
If I want a thread to sleep for five seconds the shortest code I could come up with is:
boost::system_time time = boost::get_system_time(); time += boost::posix_time::seconds(5); boost::thread::sleep(time);
It would be nice if it was possible to pass a time_duration object to sleep() directly:
boost::thread::sleep(boost::posix_time::seconds(5));
This would also be consistent with the deadline_timer in Boost.Asio whose constructor accepts both a time and a time_duration.
boost::thread::sleep is only provided for backwards compatibility. boost::this_thread::sleep has the absolute time/duration overloads you desire: boost::this_thread::sleep(boost::posix_time::seconds(5)); Anthony -- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK