Boost logo

Boost :

Subject: Re: [boost] [thread] sleep() with time_duration?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-14 18:46:31


----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, November 15, 2008 12:29 AM
Subject: Re: [boost] [thread] sleep() with time_duration?

>
> On Nov 14, 2008, at 5:56 PM, vicente.botet wrote:
>
>> ----- Original Message ----- From: "Anthony Williams"
>> <anthony.ajw_at_[hidden]
>> >
>> To: <boost_at_[hidden]>
>> Sent: Friday, November 14, 2008 1:36 PM
>> Subject: Re: [boost] [thread] sleep() with time_duration?
>>
>>
>>> Boris <boriss_at_[hidden]> writes:
>>>> It would be nice if it was possible to pass a time_duration object to
>>>> sleep() directly:
>>>>
>>>> boost::thread::sleep(boost::posix_time::seconds(5));
>>> boost::thread::sleep is only provided for backwards compatibility.
>>> boost::this_thread::sleep has the absolute time/duration overloads you
>>> desire:
>>> boost::this_thread::sleep(boost::posix_time::seconds(5));
>>
>> The current proposal n2497 contains two overloadings
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html
>> void boost::this_thread::sleep(const system_time& abs_t);
>> template <class Duration>
>> void boost::this_thread::sleep(const Duration& rel_t);
>>
>> Boost.Thread contains only the template <class Duration>
>> void boost::this_thread::sleep(const Duration& rel_t);
>>
>> Could you add the other?
>
> N2497 was overridden by N2661:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#Threads_wording
>
> This is all put together in the latest working draft:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf
>
> namespace std {
> namespace this_thread {
>
> template <class Clock, class Duration>
> void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
> template <class Rep, class Period>
> void sleep_for(const chrono::duration<Rep, Period>& rel_time);
>
> }
> }

Yes, I know that, see my preceding post. But we don't have yet chrono in
boost.
Waiting for that maybe Anthony can add this

    template <class AbsoluteTime>
    void boost::this_thread::sleep_until(Time& abs_t);
    template <class Duration>
           void boost::this_thread::sleep_for(const Duration& rel_t);

Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk