2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-27 19:32:11 +00:00

Sleeping for a negative time is same as sleeping for 0ms, fix for

issue #3178


[SVN r62122]
This commit is contained in:
Anthony Williams
2010-05-21 16:59:56 +00:00
parent fb150b5038
commit 9c25df3402

View File

@@ -144,6 +144,11 @@ namespace boost
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 @@ namespace boost
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)
{