Boost logo

Boost Users :

Subject: [Boost-users] [Thread] Bug in 1.35.0 and 1.36.0 timed wait code.
From: Ross Wightman (rwightman_at_[hidden])
Date: 2008-10-17 15:57:25


I posted this shortly after the 1.36.0 release but I neglected to put
the [thread] tag in the subject. Since I noticed 1.37 is already being
finalized I figured I'd post again.

There is a bug in the get_due_time(...) function in
lib/src/win32/thread.cpp line 343 when boost::date_time is setup to
have nanosecond resolution. The integer division always results in a
due_time of 0 so the timed waits never wait. I fixed my local copy by
changing the order of operations but I haven't investigated to see if
this could cause an overflow in situations where nanosecond time
resolution has not been configured.

In general I question whether it was a good idea to have the threading
library depend on date_time? There is a lot of functionality and code
in date_time that the thread library doesn't need. The C++0x standard
suggests a much simpler system_time class. While there is overlap
between such a system_time class and the date_time class, the smaller
compile time / code size costs and lower chance of bugs when only
using the threading library seems worth it.

Regards,

Ross


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