This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] libstdc++/64368 add configure check for timed mutex operations
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 27 Jan 2015 13:07:51 +0000
- Subject: Re: [patch] libstdc++/64368 add configure check for timed mutex operations
- Authentication-results: sourceware.org; auth=none
- References: <20150126234244 dot GY3360 at redhat dot com>
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.
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()