diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e4ca68dee85..c0307d23989 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -16,6 +16,14 @@ (unlock_shared): Add Debug Mode assertion. * testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: New. + * include/std/shared_mutex (shared_timed_mutex): Only use + pthread_rwlock_t when the POSIX Timeouts option is supported. + * testsuite/30_threads/shared_lock/cons/5.cc: Remove + dg-require-gthreads-timed. + * testsuite/30_threads/shared_lock/cons/6.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/3.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/4.cc: Likewise. + 2015-04-09 H.J. Lu * config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Update. diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index 7f26465788b..b72a822a57b 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -57,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// shared_timed_mutex class shared_timed_mutex { -#ifdef _GLIBCXX_USE_PTHREAD_RWLOCK_T +#if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK typedef chrono::system_clock __clock_t; #ifdef PTHREAD_RWLOCK_INITIALIZER @@ -116,7 +116,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) @@ -158,7 +157,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const auto __s_atime = __s_entry + __delta; return try_lock_until(__s_atime); } -#endif void unlock() @@ -200,7 +198,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; } -#if _GTHREAD_USE_MUTEX_TIMEDLOCK template bool try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) @@ -258,7 +255,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const auto __s_atime = __s_entry + __delta; return try_lock_shared_until(__s_atime); } -#endif void unlock_shared() @@ -266,7 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION unlock(); } -#else // ! _GLIBCXX_USE_PTHREAD_RWLOCK_T +#else // ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK) // Must use the same clock as condition_variable typedef chrono::system_clock __clock_t; @@ -459,7 +455,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_gate1.notify_one(); } } -#endif // ! _GLIBCXX_USE_PTHREAD_RWLOCK_T +#endif // _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK }; #endif // _GLIBCXX_HAS_GTHREADS diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc index 63ab5149a73..9ec0498620a 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc @@ -3,7 +3,6 @@ // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc index 8b2bcd5e492..2074bbefd48 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc @@ -3,7 +3,6 @@ // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc index b67022a0f42..4b653eafe43 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc @@ -3,7 +3,6 @@ // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc index e87d0dd73a1..afeefa2aca0 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc @@ -3,7 +3,6 @@ // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. //