Boost logo

Boost :

Subject: Re: [boost] [thread] Integration with Chrono and DateTime
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-10-20 10:41:46

On Wednesday 17 October 2012 07:57:33 Vicente Botet wrote:
> Could you show the interface the class B look like with this traits?

Ok, I started experimenting with the idea and have put together a sort of
proof of concept. Please, find attached the patch that modifies
boost::timed_mutex for POSIX systems and also adds the necessary bits to
Boost.DateTime. The new headers are attached separately.

A few words of summary:

1. The new files are: boost/date_time/thread_support.hpp,
boost/thread/detail/thread_time_traits.hpp, boost/thread/posix/time_units.hpp.

2. I had to make a few includes in thread_time_traits.hpp - the time_units.hpp
for the current platform, which includes config.hpp and cstdint.hpp. These
headers are included by DateTime, Chrono and Thread anyway, so harm is really

3. I removed explicit support for boost::xtime. This type is long deprecated
so I was wondering if there is need for supporting it at all. If there is, it
can be plugged in with another thread_time_traits specialization.

4. A nice outcome of the modification is that timed_mutex interface is now
unified with regard to time units, so it is now possible to do:


which was previously only possible with Chrono units.

5. The thread_time_traits interface appeared quite concise (just one
conversion function). I also introduced a tag typedef just in case it is
needed for dispatching somewhere, but it's not needed now. I will remove it if
no such need arises.

Please tell me what you think about it.

Boost list run by bdawes at, gregod at, cpdaniel at, john at