On Thu, Jan 16, 2014 at 8:50 PM, Eric Niebler
On 01/15/2014 02:06 PM, Andrey Semashev wrote:
... decoupling from the time units is desirable because (a) in many cases you don't need time units with synchronization yet you still introduce dependency on Boost.Chrono and Boost.DateTime
But in many cases you *do* care about time (e.g. wait with a time-out).
Yes, but why should these cases impose a mandatory dependency? I don't want to pay for that when e.g. I just need a mutex to synchronize access.
How will you present a unified, consistent interface when you can't express some fundamental operations?
and (b) there is no way to use use e.g. std::chrono with Boost.Thread without manually converting to Boost time units.
This sounds like a failure of generic design to me. There should be a Duration concept, and the APIs should work with any concrete type that models that concept. That would also solve the dependency problem, since the actual concrete types don't need to be mentioned.
It's a little more complicated than that because Boost.DateTime and Boost.Chrono implement different interfaces (as well as Boost.Thread wrt different time units). But basically, that's what "decoupling" means and what Boost.Sync does.