Boost logo

Boost Users :

Subject: Re: [Boost-users] Crash in boost::thread::sleep(xt) (boost 1.42 on Windows 32 bit)
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-03-23 05:14:40


On Fri, Mar 23, 2012 at 8:43 AM, Arno <arno.schaefer_at_[hidden]> wrote:

>
> is there nobody who has some experience in this aerea?
> Our thread, what should run in an endless loop, crashes without any notice
> in the call:
> boost::this_thread::sleep(boost::posix_time::milliseconds(millisec_));
>
> The visual studio 2008 debugger didn't stop in any exception, so what can
> cause this crash and how can I find out the reason? The problem is
> reproducible
> in our complex scenario.
>
> regards
> Arno
>

Is this really a correct way of calling sleep? There are 2 overloads of
sleep function:
The one which defines the duration (how long to sleep) and the other the
time-point until which the thread should at least sleep. I assume you are
going to use the second one, therefore the call should be:

  boost::this_thread::sleep(boost::get_system_time()+boost::posix_time::milliseconds(millisec_));

Hope this is going to resolve your issue... I wonder if that is really
intended that an implicit cast from milliseconds to system_time or duration
object is really a good idea???

With Kind Regards,
Ovanes



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