diff mbox

libstdc++/64368 add configure check for timed mutex operations

Message ID 20150127130751.GZ3360@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Jan. 27, 2015, 1:07 p.m. UTC
This isn't related to the last patch for this bug, except that the PR
is currently being used for all darwin FAILs.

We need to check a configure macro before using
pthread_rwlock_timedrdlock because Darwin doesn't define the
_POSIX_TIMEOUTS option.

Tested x86_64-linux, committed to trunk.
diff mbox

Patch

commit d48fe00ea96b3515a6a1f7a6926dfe2ff7db643c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 27 10:38:09 2015 +0000

    	PR libstdc++/64368
    	* include/std/shared_mutex (shared_timed_mutex::try_lock_for,
    	shared_timed_mutex::try_lock_until): Only define when POSIX thread
    	timeouts option is supported.
    	(shared_timed_mutex::try_shared_lock_for,
    	shared_timed_mutex::try_shared_lock_until): Likewise.

diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 643768c..47cfc64 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -108,6 +108,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return true;
     }
 
+#if _GTHREAD_USE_MUTEX_TIMEDLOCK
     template<typename _Rep, typename _Period>
       bool
       try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
@@ -149,6 +150,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	const auto __s_atime = __s_entry + __delta;
 	return try_lock_until(__s_atime);
       }
+#endif
 
     void
     unlock()
@@ -186,6 +188,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return true;
     }
 
+#if _GTHREAD_USE_MUTEX_TIMEDLOCK
     template<typename _Rep, typename _Period>
       bool
       try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
@@ -230,6 +233,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	const auto __s_atime = __s_entry + __delta;
 	return try_lock_shared_until(__s_atime);
       }
+#endif
 
     void
     unlock_shared()