This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch libstdc++] Add POSIX variant of shared_timed_mutex.


On 16/01/15 14:12 +0100, Torvald Riegel wrote:
[Resend.  Sorry for the noise on gcc@.]

This adds a POSIX-based implementation of shared_timed_mutex, using
pthread_rwlock_* operations directly instead of implementing with
mutexes and two condvars.  This enables using an optimized
pthread_rwlock_t on POSIX.

Tested on x86_64-linux.

OK?

OK for trunk - thanks.

diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 8bfede3..643768c 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -57,6 +57,188 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  /// shared_timed_mutex
  class shared_timed_mutex
  {
+#if defined(__GTHREADS_CXX0X)

N.B. I advised Torvald that this macro was OK to check that we have
pthread_rwlock_t available. It's not strictly correct, but currently
only gthr-posix.h defines __GTHREADS_CXX0X so it works in practice. We
should come up with something better at a later date though, or if any
other gthreads model ever supports C++11 threads.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]