(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 <hongjiu.lu@intel.com>
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Update.
/// 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
return true;
}
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
template<typename _Rep, typename _Period>
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
const auto __s_atime = __s_entry + __delta;
return try_lock_until(__s_atime);
}
-#endif
void
unlock()
return true;
}
-#if _GTHREAD_USE_MUTEX_TIMEDLOCK
template<typename _Rep, typename _Period>
bool
try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
const auto __s_atime = __s_entry + __delta;
return try_lock_shared_until(__s_atime);
}
-#endif
void
unlock_shared()
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;
_M_gate1.notify_one();
}
}
-#endif // ! _GLIBCXX_USE_PTHREAD_RWLOCK_T
+#endif // _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
};
#endif // _GLIBCXX_HAS_GTHREADS
// { 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.
//
// { 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.
//
// { 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.
//
// { 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.
//