mirror of
https://github.com/boostorg/thread.git
synced 2026-02-03 09:42:16 +00:00
Compare commits
4 Commits
boost-1.69
...
boost-1.29
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60326d5b37 | ||
|
|
9169abc03f | ||
|
|
13233e3146 | ||
|
|
813620fa7c |
@@ -92,7 +92,7 @@ private:
|
||||
#endif
|
||||
|
||||
typedef detail::thread::lock_ops<M> lock_ops;
|
||||
lock_ops::lock_state state;
|
||||
typename lock_ops::lock_state state;
|
||||
lock_ops::unlock(mutex, state);
|
||||
|
||||
#if defined(BOOST_HAS_PTHREADS)
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
#endif
|
||||
|
||||
typedef detail::thread::lock_ops<M> lock_ops;
|
||||
lock_ops::lock_state state;
|
||||
typename lock_ops::lock_state state;
|
||||
lock_ops::unlock(mutex, state);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace
|
||||
|
||||
// Test timed_wait.
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 10;
|
||||
while (data->notified != 3)
|
||||
data->condition.timed_wait(lock, xt);
|
||||
@@ -81,7 +81,7 @@ namespace
|
||||
data->condition.notify_one();
|
||||
|
||||
// Test predicate timed_wait.
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 10;
|
||||
cond_predicate pred(data->notified, 4);
|
||||
BOOST_CHECK(data->condition.timed_wait(lock, xt, pred));
|
||||
@@ -142,7 +142,7 @@ void test_condition_waits()
|
||||
boost::mutex::scoped_lock lock(data.mutex);
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
data.notified++;
|
||||
@@ -152,7 +152,7 @@ void test_condition_waits()
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
BOOST_CHECK_EQUAL(data.awoken, 1);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
data.notified++;
|
||||
@@ -162,7 +162,7 @@ void test_condition_waits()
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
BOOST_CHECK_EQUAL(data.awoken, 2);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
data.notified++;
|
||||
@@ -172,7 +172,7 @@ void test_condition_waits()
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
BOOST_CHECK_EQUAL(data.awoken, 3);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
data.notified++;
|
||||
@@ -183,7 +183,7 @@ void test_condition_waits()
|
||||
BOOST_CHECK_EQUAL(data.awoken, 4);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
thread.join();
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace
|
||||
inline bool xtime_in_range(boost::xtime& xt, int less_seconds, int greater_seconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
|
||||
boost::xtime less = cur;
|
||||
less.sec += less_seconds;
|
||||
@@ -44,7 +44,7 @@ struct test_lock
|
||||
|
||||
// Construct and initialize an xtime for a fast time out.
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.nsec += 100000000;
|
||||
|
||||
// Test the lock and the mutex with condition variables.
|
||||
@@ -86,7 +86,7 @@ struct test_trylock
|
||||
|
||||
// Construct and initialize an xtime for a fast time out.
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.nsec += 100000000;
|
||||
|
||||
// Test the lock and the mutex with condition variables.
|
||||
@@ -122,7 +122,7 @@ struct test_timedlock
|
||||
{
|
||||
// Construct and initialize an xtime for a fast time out.
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.nsec += 100000000;
|
||||
|
||||
timed_lock_type lock(mutex, xt);
|
||||
@@ -137,7 +137,7 @@ struct test_timedlock
|
||||
|
||||
// Construct and initialize an xtime for a fast time out.
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.nsec += 100000000;
|
||||
|
||||
// Test the lock and the mutex with condition variables.
|
||||
@@ -154,7 +154,7 @@ struct test_timedlock
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
lock.unlock();
|
||||
BOOST_CHECK(!lock);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.nsec += 100000000;
|
||||
BOOST_CHECK(lock.timed_lock(xt));
|
||||
BOOST_CHECK(lock ? true : false);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace
|
||||
inline bool xtime_in_range(boost::xtime& xt, int less_seconds, int greater_seconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
|
||||
boost::xtime less = cur;
|
||||
less.sec += less_seconds;
|
||||
@@ -53,7 +53,7 @@ namespace
|
||||
void test_sleep()
|
||||
{
|
||||
boost::xtime xt;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&xt, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
xt.sec += 3;
|
||||
|
||||
boost::thread::sleep(xt);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
void test_xtime_cmp()
|
||||
{
|
||||
boost::xtime xt1, xt2, cur;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
|
||||
xt1 = xt2 = cur;
|
||||
xt1.nsec -= 1;
|
||||
@@ -27,12 +27,12 @@ void test_xtime_cmp()
|
||||
void test_xtime_get()
|
||||
{
|
||||
boost::xtime orig, cur, old;
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&orig, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&orig, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
old = orig;
|
||||
|
||||
for (int x=0; x < 100; ++x)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), boost::TIME_UTC);
|
||||
BOOST_CHECK_EQUAL(boost::xtime_get(&cur, boost::TIME_UTC), static_cast<int>(boost::TIME_UTC));
|
||||
BOOST_CHECK(boost::xtime_cmp(cur, orig) >= 0);
|
||||
BOOST_CHECK(boost::xtime_cmp(cur, old) >= 0);
|
||||
old = cur;
|
||||
|
||||
Reference in New Issue
Block a user