Boost logo

Boost Users :

Subject: Re: [Boost-users] [chron] time_point convertible?
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2014-01-17 02:33:25


2014/1/16 Vicente J. Botet Escriba <vicente.botet_at_[hidden]>

> Olivers, such a conversion is not possible with the current interface.
>

that's pity - because I've the problem to achieve your request regarding to
make the
algorithm interface accepting every time_point provided by or derived from
boost.chrono.

the interface 'algorithm' has pure virtual functions only, so I can't use
templated functions
(e.g. make clock-type an template argument).

another solution would be making the interface class itself to an template
(using the clock-type
as template arg.). but this breaks the API because every class (even fiber
itself) of the lib
depended on the template arg of algorithm. this is caused by the fact that
the scheduler
 implementation (derived from interface 'algorithm') is accessed through a
pointer of type
'algorithm'.
for instance mutex::lock() suspends a fiber if the mutex is already locked
by another fiber.
suspending is done by calling algorithm::wait(). this is done via
detail::scheduler::instance()->wait();
as you see - scheduler::instance() returns the pointer to algorithm (stored
inside a static thread_specific_ptr).
thus scheduler must know the template argument of algorithm and therefore
mutex needs too.
As you see all class would be affected and this makes the API itself
unusable.

do you have any other idea to get your request from the review working?
or might it acceptable to use on clock-type from boost.chrono?



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