Boost logo

Boost :

Subject: [boost] [thread] sleep() with time_duration?
From: Boris (boriss_at_[hidden])
Date: 2008-11-14 05:38:54


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.

Boris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk