aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-01-31 16:54:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-01-31 16:54:49 +0000
commit6e4a660f122aa663077ebc4250597a40904a0720 (patch)
treef8bff3035c94f5f24e0a2ef4637b8a3a190cb565
parentb0a69d2062d2e866c74d47d6b7e44ded0eee9826 (diff)
downloadgcc-6e4a660f122aa663077ebc4250597a40904a0720.zip
gcc-6e4a660f122aa663077ebc4250597a40904a0720.tar.gz
gcc-6e4a660f122aa663077ebc4250597a40904a0720.tar.bz2
revert: condition_variable (condition_variable_any:: wait<>(_Lock&)): Provide definition.
2010-01-31 Paolo Carlini <paolo.carlini@oracle.com> Revert last changes. Also revert, among the previous changes: * include/std/condition_variable (condition_variable_any:: wait<>(_Lock&)): Provide definition. From-SVN: r156403
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/std/condition_variable51
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc61
5 files changed, 10 insertions, 112 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5dddc09..1c579a0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Revert last changes. Also revert, among the previous changes:
+ * include/std/condition_variable (condition_variable_any::
+ wait<>(_Lock&)): Provide definition.
+
2010-01-29 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/condition_variable (condition_variable_any::
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 329b972..d59fdd4 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -165,7 +165,6 @@ namespace std
// Like above, only mutex may not have try_lock.
class condition_variable_any
{
- typedef chrono::system_clock __clock_t;
typedef __gthread_cond_t __native_type;
__native_type _M_cond;
@@ -186,13 +185,7 @@ namespace std
template<typename _Lock>
void
- wait(_Lock& __lock)
- {
- int __e = __gthread_cond_wait(&_M_cond,
- __lock.mutex()->native_handle());
- if (__e)
- __throw_system_error(__e);
- }
+ wait(_Lock& __lock);
template<typename _Lock, typename _Predicate>
void
@@ -202,25 +195,10 @@ namespace std
wait(__lock);
}
- template<typename _Lock, typename _Duration>
- cv_status
- wait_until(_Lock& __lock,
- const chrono::time_point<__clock_t, _Duration>& __atime)
- { return __wait_until_impl(__lock, __atime); }
-
template<typename _Lock, typename _Clock, typename _Duration>
cv_status
wait_until(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __atime)
- {
- // DR 887 - Sync unknown clock to known clock.
- const typename _Clock::time_point __c_entry = _Clock::now();
- const __clock_t::time_point __s_entry = __clock_t::now();
- const chrono::nanoseconds __delta = __atime - __c_entry;
- const __clock_t::time_point __s_atime = __s_entry + __delta;
-
- return __wait_until_impl(__lock, __s_atime);
- }
+ const chrono::time_point<_Clock, _Duration>& __atime);
template<typename _Lock, typename _Clock,
typename _Duration, typename _Predicate>
@@ -248,31 +226,6 @@ namespace std
native_handle_type
native_handle()
{ return &_M_cond; }
-
- private:
- template<typename _Lock, typename _Clock, typename _Duration>
- cv_status
- __wait_until_impl(_Lock& __lock,
- const chrono::time_point<_Clock, _Duration>& __atime)
- {
- chrono::time_point<__clock_t, chrono::seconds> __s =
- chrono::time_point_cast<chrono::seconds>(__atime);
-
- chrono::nanoseconds __ns =
- chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
-
- __gthread_time_t __ts =
- {
- static_cast<std::time_t>(__s.time_since_epoch().count()),
- static_cast<long>(__ns.count())
- };
-
- __gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(),
- &__ts);
-
- return (_Clock::now() < __atime
- ? cv_status::no_timeout : cv_status::timeout);
- }
};
// @} group condition_variables
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 8fa79a2..5e3e302 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 *-*-* } 178 }
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 344f90c..2b61c1b 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 *-*-* } 177 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc
deleted file mode 100644
index 2cb21ed..0000000
--- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
-// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
-// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
-// { dg-require-cstdint "" }
-// { dg-require-gthreads "" }
-
-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <chrono>
-#include <condition_variable>
-#include <system_error>
-#include <testsuite_hooks.h>
-
-void test01()
-{
- bool test __attribute__((unused)) = true;
-
- try
- {
- std::chrono::microseconds ms(500);
- std::condition_variable_any c1;
- std::mutex m;
- 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 );
- VERIFY( (std::chrono::monotonic_clock::now() - then) >= ms );
- VERIFY( l.owns_lock() );
- }
- catch (const std::system_error& e)
- {
- VERIFY( false );
- }
- catch (...)
- {
- VERIFY( false );
- }
-}
-
-int main()
-{
- test01();
- return 0;
-}