Boost logo

Boost Users :

Subject: Re: [Boost-users] [data_time] Are posix_time functions reentrant ?
From: Igor R (boost.lists_at_[hidden])
Date: 2009-07-21 05:28:15


> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net