Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2008-05-28 05:00:24


Author: anthonyw
Date: 2008-05-28 05:00:23 EDT (Wed, 28 May 2008)
New Revision: 45858
URL: http://svn.boost.org/trac/boost/changeset/45858

Log:
Added documentation for time support in the thread library
Added:
   trunk/libs/thread/doc/time.qbk (contents, props changed)

Added: trunk/libs/thread/doc/time.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/thread/doc/time.qbk 2008-05-28 05:00:23 EDT (Wed, 28 May 2008)
@@ -0,0 +1,64 @@
+[section:time Date and Time Requirements]
+
+As of Boost 1.35.0, the __boost_thread__ library uses the [link date_time Boost.Date_Time] library for all operations that require a
+time out. These include (but are not limited to):
+
+* __sleep__
+* __timed_join__
+* __cond_timed_wait__
+* __timed_lock_ref__
+
+For the overloads that accept an absolute time parameter, an object of type [link thread.time.system_time `boost::system_time`] is
+required. Typically, this will be obtained by adding a duration to the current time, obtained with a call to [link
+thread.time.get_system_time `boost::get_system_time()`]. e.g.
+
+ boost::system_time const timeout=boost::get_system_time() + boost::posix_time::milliseconds(500);
+
+ extern bool done;
+ extern boost::mutex m;
+ extern boost::condition_variable cond;
+
+ boost::unique_lock<boost::mutex> lk(m);
+ while(!done)
+ {
+ if(!cond.timed_wait(lk,timeout))
+ {
+ throw "timed out";
+ }
+ }
+
+For the overloads that accept a ['TimeDuration] parameter, an object of any type that meets the [link
+date_time.posix_time.time_duration Boost.Date_Time Time Duration requirements] can be used, e.g.
+
+ boost::this_thread::sleep(boost::posix_time::milliseconds(25));
+
+ boost::mutex m;
+ if(m.timed_lock(boost::posix_time::nanoseconds(100)))
+ {
+ // ...
+ }
+
+[section:system_time Typedef `system_time`]
+
+ typedef boost::posix_time::ptime system_time;
+
+See the documentation for [link date_time.posix_time.ptime_class `boost::posix_time::ptime`] in the Boost.Date_Time library.
+
+[endsect]
+
+[section:get_system_time Non-member function `get_system_time()`]
+
+ system_time get_system_time();
+
+[variablelist
+
+[[Returns:] [The current time.]]
+
+[[Throws:] [Nothing.]]
+
+]
+
+[endsect]
+
+
+[endsect]
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk