diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2009-12-18 09:44:54 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-12-18 09:44:54 +0000 |
commit | a957d12f7af10635819c754d26be87988e926fed (patch) | |
tree | b755453be8f098a34c0f4d66b6b194a2fbfd0e1c /libstdc++-v3 | |
parent | 4ef8972563c56304859db4bb3571f96004408a9f (diff) | |
download | gcc-a957d12f7af10635819c754d26be87988e926fed.zip gcc-a957d12f7af10635819c754d26be87988e926fed.tar.gz gcc-a957d12f7af10635819c754d26be87988e926fed.tar.bz2 |
condition_variable: Revert inadvertent changes.
2009-12-18 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/condition_variable: Revert inadvertent changes.
* testsuite/30_threads/condition_variable/cons/assign_neg.cc: Ditto.
* testsuite/30_threads/condition_variable/cons/copy_neg.cc: Ditto.
* testsuite/30_threads/condition_variable/members/1.cc: Ditto.
* testsuite/30_threads/condition_variable/members/2.cc: Ditto.
* testsuite/30_threads/condition_variable_any/cons/assign_neg.cc: Ditto.
* testsuite/30_threads/condition_variable_any/cons/copy_neg.cc: Ditto.
From-SVN: r155343
Diffstat (limited to 'libstdc++-v3')
7 files changed, 16 insertions, 20 deletions
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index f5e4db15..f87eb1b 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -50,9 +50,6 @@ namespace std * @{ */ - /// cv_status - enum class cv_status { no_timeout, timeout }; - /// condition_variable class condition_variable { @@ -87,13 +84,13 @@ namespace std } template<typename _Duration> - cv_status + bool wait_until(unique_lock<mutex>& __lock, const chrono::time_point<__clock_t, _Duration>& __atime) { return __wait_until_impl(__lock, __atime); } template<typename _Clock, typename _Duration> - cv_status + bool wait_until(unique_lock<mutex>& __lock, const chrono::time_point<_Clock, _Duration>& __atime) { @@ -113,14 +110,14 @@ namespace std _Predicate __p) { while (!__p()) - if (wait_until(__lock, __atime) == cv_status::timeout) + if (!wait_until(__lock, __atime)) return __p(); return true; } template<typename _Rep, typename _Period> - cv_status + bool wait_for(unique_lock<mutex>& __lock, const chrono::duration<_Rep, _Period>& __rtime) { return wait_until(__lock, __clock_t::now() + __rtime); } @@ -138,7 +135,7 @@ namespace std private: template<typename _Clock, typename _Duration> - cv_status + bool __wait_until_impl(unique_lock<mutex>& __lock, const chrono::time_point<_Clock, _Duration>& __atime) { @@ -157,8 +154,7 @@ namespace std __gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(), &__ts); - return (_Clock::now() < __atime - ? cv_status::no_timeout : cv_status::timeout); + return _Clock::now() < __atime; } }; @@ -193,7 +189,7 @@ namespace std wait(_Lock& __lock, _Predicate __p); template<typename _Lock, typename _Clock, typename _Duration> - cv_status + bool wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __atime); @@ -205,7 +201,7 @@ namespace std _Predicate __p); template<typename _Lock, typename _Rep, typename _Period> - cv_status + bool wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime); template<typename _Lock, typename _Rep, diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc index 9e9ad8a..04e492b 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc @@ -32,4 +32,4 @@ void test01() } // { dg-error "used here" "" { target *-*-* } 31 } -// { dg-error "deleted function" "" { target *-*-* } 70 } +// { dg-error "deleted function" "" { target *-*-* } 67 } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc index 5765351..0d06628 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc @@ -31,4 +31,4 @@ void test01() } // { dg-error "used here" "" { target *-*-* } 30 } -// { dg-error "deleted function" "" { target *-*-* } 69 } +// { dg-error "deleted function" "" { target *-*-* } 66 } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc index 127960a..4dea137 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc @@ -40,8 +40,8 @@ int main() std::unique_lock<std::mutex> l(m); auto then = std::chrono::system_clock::now(); - std::cv_status result = c1.wait_for(l, ms); - VERIFY( result == std::cv_status::timeout ); + bool result = c1.wait_for(l, ms); + VERIFY( !result ); VERIFY( (std::chrono::system_clock::now() - then) >= ms ); VERIFY( l.owns_lock() ); } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc index ab2e877..fe17666 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc @@ -40,8 +40,8 @@ int main() std::unique_lock<std::mutex> l(m); auto then = std::chrono::monotonic_clock::now(); - std::cv_status result = c1.wait_until(l, then + ms); - VERIFY( result == std::cv_status::timeout ); + bool result = c1.wait_until(l, then + ms); + VERIFY( !result ); VERIFY( (std::chrono::monotonic_clock::now() - then) >= ms ); VERIFY( l.owns_lock() ); } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc index 14990a2..473f326 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc @@ -32,4 +32,4 @@ void test01() } // { dg-error "used here" "" { target *-*-* } 31 } -// { dg-error "deleted function" "" { target *-*-* } 179 } +// { dg-error "deleted function" "" { target *-*-* } 175 } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc index 1a48a9e..1d06c2d 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc @@ -31,4 +31,4 @@ void test01() } // { dg-error "used here" "" { target *-*-* } 30 } -// { dg-error "deleted function" "" { target *-*-* } 178 } +// { dg-error "deleted function" "" { target *-*-* } 174 } |