Boost logo

Boost :

Subject: Re: [boost] [thread] boost::this_thread::sleep broken?
From: Jamie Allsop (ja11sop_at_[hidden])
Date: 2011-01-02 16:41:31


On 02/01/11 05:19, Steven Watanabe wrote:
> AMDG
>
> On 12/24/2010 6:06 PM, Jamie Allsop wrote:
>> From the docs I'd expect to be able to write this:
>>
>> std::cout
>> << "Time Before Sleep: "
>> << boost::posix_time::microsec_clock::local_time()
>> << std::endl;
>>
>> boost::this_thread::sleep( boost::posix_time::seconds(10) );
>>
>> std::cout
>> << "Time After Sleep : "
>> << boost::posix_time::microsec_clock::local_time()
>> << std::endl;
>>
>> and have the 'this' thread sleep for approximately 10 seconds. Instead
>> sleep returns instantaneously:
>>
>> Time Before Sleep: 2010-Dec-25 01:38:50.949160000
>> Time After Sleep : 2010-Dec-25 01:38:50.949436000
>>
>> I've tried this with boost 1.45 and boost 1.43 using gcc 4.4 on debian
>> x86_64. Am I missing something obvious?
>
> The code works for me with 32-bit on both Linux and Windows.

Thanks for checking - this worked fine for me on 32-bit Linux also
(Debian Unstable, gcc 4.3). In addition to sleep returning
instantaneously (happens every time) with more complex scenarios
involving multiple threads I see sleep enter a busy spin, never
returning (process needs killed). I am trying to create a minimal test
case for this.

I added ticket https://svn.boost.org/trac/boost/ticket/5034 to track this.

Jamie

>
> In Christ,
> Steven Watanabe


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