|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62122 - trunk/boost/thread/win32
From: anthony_at_[hidden]
Date: 2010-05-21 12:59:57
Author: anthonyw
Date: 2010-05-21 12:59:56 EDT (Fri, 21 May 2010)
New Revision: 62122
URL: http://svn.boost.org/trac/boost/changeset/62122
Log:
Sleeping for a negative time is same as sleeping for 0ms, fix for
issue #3178
Text files modified:
trunk/boost/thread/win32/thread_data.hpp | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
Modified: trunk/boost/thread/win32/thread_data.hpp
==============================================================================
--- trunk/boost/thread/win32/thread_data.hpp (original)
+++ trunk/boost/thread/win32/thread_data.hpp 2010-05-21 12:59:56 EDT (Fri, 21 May 2010)
@@ -144,6 +144,11 @@
start(0),milliseconds(~uintmax_t(0)),relative(true)
{}
};
+
+ unsigned long pin_to_zero(long value)
+ {
+ return (value<0)?0u:(unsigned long)value;
+ }
}
namespace this_thread
@@ -163,7 +168,7 @@
template<typename TimeDuration>
inline void sleep(TimeDuration const& rel_time)
{
- interruptible_wait(static_cast<unsigned long>(rel_time.total_milliseconds()));
+ interruptible_wait(detail::pin_to_zero(rel_time.total_milliseconds()));
}
inline void sleep(system_time const& abs_time)
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk