21 Jul
2009
21 Jul
'09
9:28 a.m.
here is a question I didn't find answers on in the documentation: Are the posix_time functions reentrant ? In particular: In my library a number of threads instantiate objects that internally measure the elapsed time like this:
// Measure the start time ptime startTime = boost::posix_time::microsec_clock::local_time(); // [...] // Has a time-out been set and if so, have we exceeded it ? if(firstTimeOut_.total_microseconds() && ((microsec_clock::local_time()-startTime) > firstTimeOut_)) { // do something }
I can't see any re-entering in the above code. As for thread-safety of the clock functions - they rely on the relevant CRT/OS clock functions, which are supposed to be thread-safe.