Subject: Re: [boost] [thread] Can boost::this_thread::sleep_for() totally stop the thread?
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2013-09-03 07:59:15


On Tue, Sep 3, 2013 at 12:05 PM, Klaim - Joël Lamotte <mjklaim_at_[hidden]>wrote:

> Diving into the code, I just realize the real source of the problem:
>
> struct BOOST_SYMBOL_VISIBLE timeout
> {
> win32::ticks_type start;
> uintmax_t milliseconds; // HERE
> bool relative;
> boost::system_time abs_time;
>
> static unsigned long const max_non_infinite_wait=0xfffffffe;
>
> timeout(uintmax_t milliseconds_): // HERE
>
> do_wait() takses a timeout which will use a unsined int as milliseconds,
> which will make any negative number very big.
> Assuming ceil() returns a negative number (I might have made a mistake in
> my precedent mail), then we get a very big timeout....
>
> I'm not sure how to fix this other than adding checks into wait_until and
> wait_for....
>

I tried replacing uintmax_t by long long in this quoted code, as a
quick-fix, and it seems to work in my repro-cases.
I'll try now recompiling my real application, see if it fix the problem
there too.

Joel Lamotte