mirror of
https://github.com/boostorg/thread.git
synced 2026-02-07 23:02:13 +00:00
Compare commits
3 Commits
fix/blocki
...
boost-1.28
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d3eb714b6 | ||
|
|
b75a32b913 | ||
|
|
c6b8f21bde |
@@ -62,9 +62,9 @@ lib boost_thread
|
|||||||
#######################
|
#######################
|
||||||
# Stage the generated targets.
|
# Stage the generated targets.
|
||||||
|
|
||||||
stage bin-stage
|
#stage bin-stage
|
||||||
: <lib>boost_thread $(threadmon)
|
# : <lib>boost_thread $(threadmon)
|
||||||
: <tag><runtime-link-static>"s"
|
# : <tag><runtime-link-static>"s"
|
||||||
<tag><debug>"d"
|
# <tag><debug>"d"
|
||||||
: debug release <runtime-link>static/dynamic
|
# : debug release <runtime-link>static/dynamic
|
||||||
;
|
#;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ void condition::do_wait()
|
|||||||
|
|
||||||
bool condition::do_timed_wait(const xtime& xt)
|
bool condition::do_timed_wait(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned milliseconds;
|
int milliseconds;
|
||||||
to_duration(xt, milliseconds);
|
to_duration(xt, milliseconds);
|
||||||
|
|
||||||
unsigned int res = 0;
|
unsigned int res = 0;
|
||||||
@@ -571,7 +571,7 @@ void condition::do_wait()
|
|||||||
|
|
||||||
bool condition::do_timed_wait(const xtime& xt)
|
bool condition::do_timed_wait(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned milliseconds;
|
int milliseconds;
|
||||||
to_duration(xt, milliseconds);
|
to_duration(xt, milliseconds);
|
||||||
|
|
||||||
OSStatus lStatus = noErr;
|
OSStatus lStatus = noErr;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ bool timed_mutex::do_trylock()
|
|||||||
|
|
||||||
bool timed_mutex::do_timedlock(const xtime& xt)
|
bool timed_mutex::do_timedlock(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned milliseconds;
|
int milliseconds;
|
||||||
to_duration(xt, milliseconds);
|
to_duration(xt, milliseconds);
|
||||||
|
|
||||||
unsigned int res = WaitForSingleObject(reinterpret_cast<HANDLE>(m_mutex), milliseconds);
|
unsigned int res = WaitForSingleObject(reinterpret_cast<HANDLE>(m_mutex), milliseconds);
|
||||||
@@ -500,7 +500,7 @@ bool timed_mutex::do_trylock()
|
|||||||
|
|
||||||
bool timed_mutex::do_timedlock(const xtime& xt)
|
bool timed_mutex::do_timedlock(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned microseconds;
|
int microseconds;
|
||||||
to_microduration(xt, microseconds);
|
to_microduration(xt, microseconds);
|
||||||
Duration lDuration = kDurationMicrosecond * microseconds;
|
Duration lDuration = kDurationMicrosecond * microseconds;
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ bool recursive_timed_mutex::do_trylock()
|
|||||||
|
|
||||||
bool recursive_timed_mutex::do_timedlock(const xtime& xt)
|
bool recursive_timed_mutex::do_timedlock(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned milliseconds;
|
int milliseconds;
|
||||||
to_duration(xt, milliseconds);
|
to_duration(xt, milliseconds);
|
||||||
|
|
||||||
unsigned int res = 0;
|
unsigned int res = 0;
|
||||||
@@ -936,7 +936,7 @@ bool recursive_timed_mutex::do_trylock()
|
|||||||
|
|
||||||
bool recursive_timed_mutex::do_timedlock(const xtime& xt)
|
bool recursive_timed_mutex::do_timedlock(const xtime& xt)
|
||||||
{
|
{
|
||||||
unsigned microseconds;
|
int microseconds;
|
||||||
to_microduration(xt, microseconds);
|
to_microduration(xt, microseconds);
|
||||||
Duration lDuration = kDurationMicrosecond * microseconds;
|
Duration lDuration = kDurationMicrosecond * microseconds;
|
||||||
|
|
||||||
|
|||||||
@@ -192,13 +192,13 @@ void thread::join()
|
|||||||
void thread::sleep(const xtime& xt)
|
void thread::sleep(const xtime& xt)
|
||||||
{
|
{
|
||||||
#if defined(BOOST_HAS_WINTHREADS)
|
#if defined(BOOST_HAS_WINTHREADS)
|
||||||
unsigned milliseconds;
|
int milliseconds;
|
||||||
to_duration(xt, milliseconds);
|
to_duration(xt, milliseconds);
|
||||||
Sleep(milliseconds);
|
Sleep(milliseconds);
|
||||||
#elif defined(BOOST_HAS_PTHREADS)
|
#elif defined(BOOST_HAS_PTHREADS)
|
||||||
# if defined(BOOST_HAS_PTHREAD_DELAY_NP)
|
# if defined(BOOST_HAS_PTHREAD_DELAY_NP)
|
||||||
timespec ts;
|
timespec ts;
|
||||||
to_timespec(xt, ts);
|
to_timespec_duration(xt, ts);
|
||||||
int res = 0;
|
int res = 0;
|
||||||
res = pthread_delay_np(&ts);
|
res = pthread_delay_np(&ts);
|
||||||
assert(res == 0);
|
assert(res == 0);
|
||||||
@@ -216,7 +216,7 @@ void thread::sleep(const xtime& xt)
|
|||||||
cond.timed_wait(lock, xt);
|
cond.timed_wait(lock, xt);
|
||||||
# endif
|
# endif
|
||||||
#elif defined(BOOST_HAS_MPTASKS)
|
#elif defined(BOOST_HAS_MPTASKS)
|
||||||
unsigned microseconds;
|
int microseconds;
|
||||||
to_microduration(xt, microseconds);
|
to_microduration(xt, microseconds);
|
||||||
Duration lMicroseconds(kDurationMicrosecond * microseconds);
|
Duration lMicroseconds(kDurationMicrosecond * microseconds);
|
||||||
AbsoluteTime sWakeTime(DurationToAbsolute(lMicroseconds));
|
AbsoluteTime sWakeTime(DurationToAbsolute(lMicroseconds));
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
// It is provided "as is" without express or implied warranty.
|
// It is provided "as is" without express or implied warranty.
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const unsigned MILLISECONDS_PER_SECOND = 1000;
|
const int MILLISECONDS_PER_SECOND = 1000;
|
||||||
const unsigned NANOSECONDS_PER_SECOND = 1000000000;
|
const int NANOSECONDS_PER_SECOND = 1000000000;
|
||||||
const unsigned NANOSECONDS_PER_MILLISECOND = 1000000;
|
const int NANOSECONDS_PER_MILLISECOND = 1000000;
|
||||||
|
|
||||||
const unsigned MICROSECONDS_PER_SECOND = 1000000;
|
const int MICROSECONDS_PER_SECOND = 1000000;
|
||||||
const unsigned NANOSECONDS_PER_MICROSECOND = 1000;
|
const int NANOSECONDS_PER_MICROSECOND = 1000;
|
||||||
|
|
||||||
inline void to_time(unsigned milliseconds, boost::xtime& xt)
|
inline void to_time(int milliseconds, boost::xtime& xt)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
res = boost::xtime_get(&xt, boost::TIME_UTC);
|
res = boost::xtime_get(&xt, boost::TIME_UTC);
|
||||||
@@ -45,7 +45,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void to_time(unsigned milliseconds, timespec& ts)
|
inline void to_time(int milliseconds, timespec& ts)
|
||||||
{
|
{
|
||||||
boost::xtime xt;
|
boost::xtime xt;
|
||||||
to_time(milliseconds, xt);
|
to_time(milliseconds, xt);
|
||||||
@@ -83,7 +83,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void to_duration(const boost::xtime& xt, unsigned& milliseconds)
|
inline void to_duration(const boost::xtime& xt, int& milliseconds)
|
||||||
{
|
{
|
||||||
boost::xtime cur;
|
boost::xtime cur;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -94,13 +94,13 @@ namespace {
|
|||||||
milliseconds = 0;
|
milliseconds = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
milliseconds = static_cast<unsigned>(((xt.sec - cur.sec) * MILLISECONDS_PER_SECOND) +
|
milliseconds = ((xt.sec - cur.sec) * MILLISECONDS_PER_SECOND) +
|
||||||
(((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MILLISECOND/2)) /
|
(((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MILLISECOND/2)) /
|
||||||
NANOSECONDS_PER_MILLISECOND));
|
NANOSECONDS_PER_MILLISECOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void to_microduration(const boost::xtime& xt, unsigned& microseconds)
|
inline void to_microduration(const boost::xtime& xt, int& microseconds)
|
||||||
{
|
{
|
||||||
boost::xtime cur;
|
boost::xtime cur;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -111,9 +111,9 @@ namespace {
|
|||||||
microseconds = 0;
|
microseconds = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
microseconds = static_cast<unsigned long>(((xt.sec - cur.sec) * MICROSECONDS_PER_SECOND) +
|
microseconds = ((xt.sec - cur.sec) * MICROSECONDS_PER_SECOND) +
|
||||||
(((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MICROSECOND/2)) /
|
(((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MICROSECOND/2)) /
|
||||||
NANOSECONDS_PER_MICROSECOND));
|
NANOSECONDS_PER_MICROSECOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user