[patch] libstdc++/65704 portable timed_mutex and recursive_timed_mutex

Jonathan Wakely jwakely@redhat.com
Fri Sep 4 10:22:00 GMT 2015

This provides alternative implementations of std::timed_mutex and
std::recursive_timed_mutex for targets that don't support the
_POSIX_TIMEOUTS option (darwin and maybe HPUX).

The new versions need to use std::condition_variable, which depends on
std::mutex, so I have moved std::mutex, std::lock_guard, and
std::unique_lock into a new header, <bits/mutex.h> so that <mutex> can

  #include <bits/mutex.h>
  # include <condition_variable>
  # include <thread>
  // existing implementations using pthread_mutex_t
  // new implementations using std::condition_variable

The new smaller <bits/mutex.h> header has the advantage that other
libstdc++ headers which only need std::mutex and the scoped locks can
include <bits/mutex.h>. We should only include <mutex> when we need
timed or recursive mutexes, or std::call_once.

Tested powerpc64le-linux as normal, and again with #undef
_GTHREAD_USE_MUTEX_TIMEDLOCK to test the new code.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 45426 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150904/118d05cb/attachment.bin>

More information about the Gcc-patches mailing list