diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0b2f5b94d637c028d8ed5ab463e48ad313d6d9c4..89e0b2a7f2d2af43f246084829e8aa66e4dd77b8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,111 @@
+2008-09-03  Chris Fairles  <chris.fairles@gmail.com>
+
+        * include/std/condition_variable: Use new deleted ctors.
+        * include/std/mutex: Likewise plus implement timed_mutex, 
+	recursive_timed_mutex and call_once.
+	* src/condition_variable.cc: Implement wait(). Use gthread types.
+	Remove _GTHREADS_HAS_COND checks in favor of global
+	_GLIBCXX_HAS_GTHREADS.
+	* src/mutex.cc (call_once): Implementation using TLS with mutex
+	fallback.
+	* config/abi/pre/gnu.ver: Add exported symbols.
+	* testsuite/lib/libstdc++.exp (check_v3_target_gthreads): New.
+	* testsuite/lib/dg-options.exp (dg-require-gthreads): Likewise.
+	* testsuite/30_threads/lock_guard/requirements/typedefs.cc: Use
+	dg-require-gthreads and dg-require-cstdint.
+	* testsuite/30_threads/lock_guard/requirements/
+	explicit_instantiation.cc: Likewise.
+	* testsuite/30_threads/mutex/dest/destructor_locked.cc: Likewise.
+	* testsuite/30_threads/mutex/native_handle/1.cc: Likewise.
+	* testsuite/30_threads/mutex/cons/1.cc: Likewise.
+	* testsuite/30_threads/mutex/requirements/typedefs.cc: Likewise.
+	* testsuite/30_threads/mutex/try_lock/1.cc: Likewise.
+	* testsuite/30_threads/mutex/try_lock/2.cc: Likewise.
+	* testsuite/30_threads/mutex/lock/1.cc: Likewise.
+	* testsuite/30_threads/mutex/unlock/1.cc: Likewise.
+	* testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc:
+	Likewise.
+        * testsuite/30_threads/recursive_mutex/native_handle/1.cc: Likewise.
+	* testsuite/30_threads/recursive_mutex/cons/1.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/requirements/typedefs.cc:
+	Likewise.
+        * testsuite/30_threads/recursive_mutex/try_lock/1.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/try_lock/2.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/lock/1.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/unlock/1.cc: Likewise.
+	* testsuite/30_threads/unique_lock/requirements/
+	explicit_instantiation.cc: Likewise.
+	* testsuite/30_threads/unique_lock/requirements/typedefs.cc: Likewise.
+        * testsuite/30_threads/mutex/cons/assign_neg.cc: Also adjust dg-error
+	lines for deleted members.
+        * testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
+        * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
+	* testsuite/30_threads/call_once/once_flag.cc: New.
+	* testsuite/30_threads/call_once/call_once1.cc: Likewise.
+	* testsuite/30_threads/condition_variable/cons/1.cc: Likewise.
+	* testsuite/30_threads/condition_variable/cons/copy_neg.cc: Likewise
+	* testsuite/30_threads/condition_variable/cons/assign_neg.cc: Likewise.
+	* testsuite/30_threads/condition_variable_any/cons/1.cc: Likewise.
+	* testsuite/30_threads/condition_variable_any/cons/copy_neg.cc:
+	Likewise.
+	* testsuite/30_threads/condition_variable_any/cons/assign_neg.cc:
+	Likewise.
+	* testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/cons/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/requirements/typedefs.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/lock/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise.
+	* testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc: 
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc: 
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc: 
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc: 
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/cons: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc: 
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc:
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc:
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc:
+	Likewise.
+	* testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc:
+	Likewise.
+	* testsuite/30_threads/unique_lock/modifiers/1.cc: Likewise.
+	* testsuite/30_threads/unique_lock/modifiers/2.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/1.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/2.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/3.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/4.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/5.cc: Likewise.
+	* testsuite/30_threads/unique_lock/cons/6.cc: Likewise.
+	* testsuite/30_threads/unique_lock/locking/1.cc: Likewise.
+	* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
+	* testsuite/30_threads/unique_lock/locking/3.cc: Likewise.
+	* testsuite/30_threads/unique_lock/locking/4.cc: Likewise.
+
 2008-09-01  Mark Mitchell  <mark@codesourcery.com>
 
 	* include/std/type_traits (__make_unsigned_selector<>): Consider
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 0ec4879ffd4ecf47e61876d599075c55d904eacc..7f940121dc86745128420b4f58fc3ffba0b400d8 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -860,13 +860,25 @@ GLIBCXX_3.4.11 {
     _ZTSSt10lock_error;
     _ZNKSt10lock_error4whatEv;
 
+    _ZSt11__once_call;
+    _ZSt15__once_callable;
+    _ZSt14__once_functor;
+    _ZSt11__once_lock;
+    _ZSt12__once_mutex;
+    __once_proxy;
+
     # condition_variable
     _ZNSt18condition_variable10notify_allEv;
     _ZNSt18condition_variable10notify_oneEv;
+    _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE;
     _ZNSt18condition_variableC1Ev;
     _ZNSt18condition_variableC2Ev;
     _ZNSt18condition_variableD1Ev;
     _ZNSt18condition_variableD2Ev;
+    _ZNSt22condition_variable_anyC1Ev;
+    _ZNSt22condition_variable_anyC2Ev;
+    _ZNSt22condition_variable_anyD1Ev;
+    _ZNSt22condition_variable_anyD2Ev;
 
     # system_error
     _ZSt18get_posix_categoryv;
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 1a7a7cd1f37d14549bb8aa54d5ff20ff77e10d1a..f2035d6de73bdd48559d60906ec5f18cb89a87dd 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -40,33 +40,25 @@
 # include <c++0x_warning.h>
 #else
 
+#include <chrono>
 #include <mutex> // unique_lock
 
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
 namespace std 
 {
-  namespace chrono
-  {
-    template<typename _Rep, typename _Period>
-      struct duration;
-
-    template<typename _Clock, typename _Duration>
-      struct time_point;
-  }
-
   /// condition_variable
   class condition_variable
   {
   public:
-
-#if __GTHREAD_HAS_COND
-    typedef __gthread_cond_t native_handle_type;
-#else
-    typedef int native_handle_type;
-#endif
+    typedef __gthread_cond_t* native_handle_type;
 
     condition_variable();
     ~condition_variable();
 
+    condition_variable(const condition_variable&) = delete;
+    condition_variable& operator=(const condition_variable&) = delete;
+
     void 
     notify_one();
 
@@ -87,7 +79,23 @@ namespace std
     template<typename _Clock, typename _Duration>
       bool 
       wait_until(unique_lock<mutex>& __lock, 
-		 const chrono::time_point<_Clock, _Duration>& __atime);
+		 const chrono::time_point<_Clock, _Duration>& __atime)
+      {
+	chrono::time_point<_Clock, chrono::seconds>  __s =
+          chrono::time_point_cast<chrono::seconds>(__atime);
+
+	chrono::nanoseconds __ns =
+          chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+
+        __gthread_time_t __ts = {
+          static_cast<std::time_t>(__s.time_since_epoch().count()),
+          static_cast<long>(__ns.count())
+        };
+	
+	__gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(), &__ts);
+	
+	return __clock_t::now() < __atime;
+      }
 
     template<typename _Clock, typename _Duration, typename _Predicate>
       bool
@@ -98,7 +106,8 @@ namespace std
     template<typename _Rep, typename _Period>
       bool
       wait_for(unique_lock<mutex>& __lock,
-	       const chrono::duration<_Rep, _Period>& __rtime);
+	       const chrono::duration<_Rep, _Period>& __rtime)
+      { return __wait_for_impl(__rtime); }
 
     template<typename _Rep, typename _Period, typename _Predicate>
       bool
@@ -107,12 +116,42 @@ namespace std
 	       _Predicate __p);
 
     native_handle_type 
-    native_handle() { return _M_cond; }
+    native_handle() 
+    { return &_M_cond; }
 
   private:
-    native_handle_type	_M_cond;
-    condition_variable(const condition_variable&);
-    condition_variable& operator=(const condition_variable&);
+    __gthread_cond_t _M_cond;
+    mutex _M_internal_mutex;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+    typedef chrono::monotonic_clock __clock_t;
+#else
+    typedef chrono::high_resolution_clock __clock_t;
+#endif
+
+    template<typename _Rep, typename _Period>
+      typename enable_if<
+        ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __wait_for_impl(unique_lock<mutex>& __lock,
+		      const chrono::duration<_Rep, _Period>& __rtime)
+      { 
+	__clock_t::time_point __atime = __clock_t::now()
+	  + chrono::duration_cast<__clock_t::duration>(__rtime);
+	
+	return wait_until(__lock, __atime);
+      }
+    
+    template<typename _Rep, typename _Period>
+      typename enable_if<
+        !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __wait_for_impl(unique_lock<mutex>& __lock,
+		      const chrono::duration<_Rep, _Period>& __rtime)
+      { 
+	__clock_t::time_point __atime = __clock_t::now()
+	  + ++chrono::duration_cast<__clock_t::duration>(__rtime);
+	
+	return wait_until(__lock, __atime);
+      }    
   };
 
   /// condition_variable_any
@@ -120,14 +159,13 @@ namespace std
   class condition_variable_any
   {
   public:
-#if __GTHREAD_HAS_COND
-    typedef __gthread_cond_t native_handle_type;
-#else
-    typedef int native_handle_type;
-#endif
+    typedef __gthread_cond_t* native_handle_type;
 
     condition_variable_any();
     ~condition_variable_any();
+    
+    condition_variable_any(const condition_variable_any&) = delete;
+    condition_variable_any& operator=(const condition_variable_any&) = delete;
 
     void 
     notify_one();
@@ -166,16 +204,16 @@ namespace std
 	       const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p);
 
     native_handle_type 
-    native_handle() { return _M_cond; }
+    native_handle()
+    { return &_M_cond; }
 
   private:
-    native_handle_type	_M_cond;
-    condition_variable_any(const condition_variable_any&);
-    condition_variable_any& operator=(const condition_variable_any&);
+    __gthread_cond_t _M_cond;
   };
-
 }
 
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
 #endif // __GXX_EXPERIMENTAL_CXX0X__
 
 #endif // _GLIBCXX_CONDITION_VARIABLE
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 779394a5891416939c82fd9b4f6ed1751c2ecce1..5e6ba9c271556ed59b32c36ad33dd2f81365d35d 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -41,39 +41,40 @@
 # include <c++0x_warning.h>
 #else
 
-#include <exception>
 #include <cstddef>
+#include <chrono>
+#include <exception>
+#include <type_traits>
+#include <functional>
+#include <system_error>
 #include <bits/functexcept.h>
 #include <bits/gthr.h>
+#include <bits/move.h> // for std::swap
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
 namespace std
 {
-  namespace chrono
-  {
-    template<typename _Rep, typename _Period>
-      struct duration;
-
-    template<typename _Clock, typename _Duration>
-      struct time_point;
-  }
-
   /// mutex
   class mutex
   {
   public:
-    typedef __gthread_mutex_t native_handle_type;
+    typedef __gthread_mutex_t* native_handle_type;
 
     mutex()
     {
       // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
-#if defined __GTHREAD_MUTEX_INIT
-      native_handle_type __tmp = __GTHREAD_MUTEX_INIT;
+#ifdef __GTHREAD_MUTEX_INIT
+      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
 #endif
     }
 
+    mutex(const mutex&) = delete;
+    mutex& operator=(const mutex&) = delete;
+
     void
     lock()
     {
@@ -100,31 +101,32 @@ namespace std
 
     native_handle_type
     native_handle()
-    { return _M_mutex; }
+    { return &_M_mutex; }
 
   private:
-    native_handle_type _M_mutex;
-    mutex(const mutex&);
-    mutex& operator=(const mutex&);
+    __gthread_mutex_t _M_mutex;
   };
 
   /// recursive_mutex
   class recursive_mutex
   {
   public:
-    typedef __gthread_recursive_mutex_t native_handle_type;
+    typedef __gthread_recursive_mutex_t* native_handle_type;
 
     recursive_mutex()
     {
       // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
-#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
-      native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+      __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
 #endif
     }
 
+    recursive_mutex(const recursive_mutex&) = delete;
+    recursive_mutex& operator=(const recursive_mutex&) = delete;
+
     void
     lock()
     {
@@ -139,85 +141,227 @@ namespace std
     try_lock()
     {
       // XXX EINVAL, EAGAIN, EBUSY
-     return !__gthread_recursive_mutex_trylock(&_M_mutex);
+      return !__gthread_recursive_mutex_trylock(&_M_mutex);
     }
 
     void
     unlock()
     {
       // XXX EINVAL, EAGAIN, EBUSY
-     __gthread_recursive_mutex_unlock(&_M_mutex);
+      __gthread_recursive_mutex_unlock(&_M_mutex);
     }
 
     native_handle_type
     native_handle()
-    { return _M_mutex; }
+    { return &_M_mutex; }
 
   private:
-    native_handle_type _M_mutex;
-
-    recursive_mutex(const recursive_mutex&);
-    recursive_mutex& operator=(const recursive_mutex&);
+    __gthread_recursive_mutex_t  _M_mutex;
   };
 
   /// timed_mutex
   class timed_mutex
-  {
+  {  
   public:
-    typedef __gthread_mutex_t native_handle_type;
+    typedef __gthread_mutex_t* native_handle_type;
 
-    void lock();
-    bool try_lock();
+    timed_mutex()
+    {
+#ifdef __GTHREAD_MUTEX_INIT
+      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+      _M_mutex = __tmp;
+#else
+      __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+    }
+
+    timed_mutex(const timed_mutex&) = delete;
+    timed_mutex& operator=(const timed_mutex&) = delete;
+
+    void
+    lock()
+    {
+      int __e = __gthread_mutex_lock(&_M_mutex);
+
+      // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+      if (__e)
+	__throw_system_error(__e);
+    }
+
+    bool
+    try_lock()
+    {
+      // XXX EINVAL, EAGAIN, EBUSY
+      return !__gthread_mutex_trylock(&_M_mutex);
+    }
 
     template <class _Rep, class _Period>
       bool
-      try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
+      try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+      { return __try_lock_for_impl(__rtime); }
 
     template <class _Clock, class _Duration>
       bool
-      try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
+      try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+      { 
+	chrono::time_point<_Clock, chrono::seconds> __s =
+          chrono::time_point_cast<chrono::seconds>(__atime);
+
+	chrono::nanoseconds __ns =
+          chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+
+        __gthread_time_t __ts = {
+          static_cast<std::time_t>(__s.time_since_epoch().count()),
+          static_cast<long>(__ns.count())
+        };
 
-    void unlock();
+	return !__gthread_mutex_timedlock(&_M_mutex, &__ts);	
+      }
+
+    void
+    unlock()
+    {
+      // XXX EINVAL, EAGAIN, EBUSY
+      __gthread_mutex_unlock(&_M_mutex);
+    }
 
     native_handle_type
     native_handle()
-    { return _M_mutex; }
+    { return &_M_mutex; }
     
   private:
-    native_handle_type _M_mutex;
+    __gthread_mutex_t _M_mutex;
+    
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+    typedef chrono::monotonic_clock __clock_t;
+#else
+    typedef chrono::high_resolution_clock __clock_t;
+#endif
 
-    timed_mutex(const timed_mutex&);
-    timed_mutex& operator=(const timed_mutex&);
+    template<typename _Rep, typename _Period>
+      typename enable_if<
+        ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+      {
+        __clock_t::time_point __atime = __clock_t::now()
+          + chrono::duration_cast<__clock_t::duration>(__rtime);
+
+        return try_lock_until(__atime);
+      }
+
+    template <typename _Rep, typename _Period>
+      typename enable_if<
+        !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+      {
+        __clock_t::time_point __atime = __clock_t::now()
+	  + ++chrono::duration_cast<__clock_t::duration>(__rtime);
+
+        return try_lock_until(__atime);
+      }
   };
 
   /// recursive_timed_mutex
   class recursive_timed_mutex
   {
   public:
-    typedef __gthread_mutex_t native_handle_type;
+    typedef __gthread_recursive_mutex_t* native_handle_type;
+
+    recursive_timed_mutex()
+    {
+      // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+      __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+      _M_mutex = __tmp;
+#else
+      __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+    }
+
+    recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+    recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+    void
+    lock()
+    {
+      int __e = __gthread_recursive_mutex_lock(&_M_mutex);
+
+      // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+      if (__e)
+	__throw_system_error(__e);
+    }
 
-    void lock();
-    bool try_lock();
+    bool
+    try_lock()
+    {
+      // XXX EINVAL, EAGAIN, EBUSY
+      return !__gthread_recursive_mutex_trylock(&_M_mutex);
+    }
 
     template <class _Rep, class _Period>
       bool
-      try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
+      try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+      { return __try_lock_for_impl(__rtime); }
 
     template <class _Clock, class _Duration>
       bool
-      try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
+      try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+      { 
+	chrono::time_point<_Clock, chrono::seconds>  __s =
+          chrono::time_point_cast<chrono::seconds>(__atime);
+
+	chrono::nanoseconds __ns =
+          chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
 
-    void unlock();
+        __gthread_time_t __ts = {
+          static_cast<std::time_t>(__s.time_since_epoch().count()),
+          static_cast<long>(__ns.count())
+        };
+
+        return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts);
+      }
+
+    void
+    unlock()
+    {
+      // XXX EINVAL, EAGAIN, EBUSY
+      __gthread_recursive_mutex_unlock(&_M_mutex);
+    }
 
     native_handle_type
     native_handle()
-    { return _M_mutex; }
-    
+    { return &_M_mutex; }
+
   private:
-    native_handle_type _M_mutex;
+    __gthread_recursive_mutex_t _M_mutex;
 
-    recursive_timed_mutex(const recursive_timed_mutex&);
-    recursive_timed_mutex& operator=(const recursive_timed_mutex&);
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+    typedef chrono::monotonic_clock __clock_t;
+#else
+    typedef chrono::high_resolution_clock __clock_t;
+#endif
+
+    template<typename _Rep, typename _Period>
+      typename enable_if<
+        ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+      {
+        __clock_t::time_point __atime = __clock_t::now()
+          + chrono::duration_cast<__clock_t::duration>(__rtime);
+
+        return try_lock_until(__atime);
+      }
+
+    template <typename _Rep, typename _Period>
+      typename enable_if<
+        !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+      __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+      {
+        __clock_t::time_point __atime = __clock_t::now()
+	  + ++chrono::duration_cast<__clock_t::duration>(__rtime);
+
+        return try_lock_until(__atime);
+      }
   };
 
   /// Do not acquire ownership of the mutex.
@@ -260,10 +404,11 @@ namespace std
       ~lock_guard()
       { _M_device.unlock(); }
 
+      lock_guard(const lock_guard&) = delete;
+      lock_guard& operator=(const lock_guard&) = delete;
+
     private:
       mutex_type&  _M_device;
-      lock_guard(lock_guard const&);
-      lock_guard& operator=(lock_guard const&);
     };
 
   /// unique_lock
@@ -272,13 +417,13 @@ namespace std
     {
     public:
       typedef _Mutex mutex_type;
-
+      
       unique_lock()
-      : _M_device(NULL), _M_owns(false)
+      : _M_device(0), _M_owns(false)
       { }
 
       explicit unique_lock(mutex_type& __m)
-      : _M_device(&__m)
+      : _M_device(&__m), _M_owns(false)
       {
 	lock();
 	_M_owns = true;
@@ -300,11 +445,15 @@ namespace std
 
       template<typename _Clock, typename _Duration>
 	unique_lock(mutex_type& __m, 
-		    const chrono::time_point<_Clock, _Duration>& __atime);
+		    const chrono::time_point<_Clock, _Duration>& __atime)
+	: _M_device(&__m), _M_owns(_M_device->try_lock_until(__atime))
+	{ }
 
       template<typename _Rep, typename _Period>
 	unique_lock(mutex_type& __m, 
-		    const chrono::duration<_Rep, _Period>& __rtime);
+		    const chrono::duration<_Rep, _Period>& __rtime)
+	: _M_device(&__m), _M_owns(_M_device->try_lock_for(__rtime))
+	{ }
 
       ~unique_lock()
       {
@@ -312,55 +461,111 @@ namespace std
 	  unlock();
       }
 
-      unique_lock(unique_lock&&);
+      unique_lock(const unique_lock&) = delete;
+      unique_lock& operator=(const unique_lock&) = delete;
+
+      unique_lock(unique_lock&& __u)
+      : _M_device(__u._M_device), _M_owns(__u._M_owns)
+      {
+	__u._M_device = 0;
+	__u._M_owns = false;
+      }
+
+      unique_lock& operator=(unique_lock&& __u)
+      {
+        if(_M_owns)
+	  unlock();
+	
+	unique_lock(std::move(__u)).swap(*this);
 
-      unique_lock& operator=(unique_lock&&);
+	__u._M_device = 0;
+	__u._M_owns = false;
+	
+	return *this;
+      }
 
       void
       lock()
       {
-	if (_M_device && !_M_owns)
-	  _M_device->lock();
+	if (!_M_device)
+	  __throw_system_error(posix_error::operation_not_permitted);
+	else if (_M_owns)
+	  __throw_system_error(posix_error::resource_deadlock_would_occur);
 	else
-	  throw lock_error();
+	  {
+	    _M_device->lock();
+	    _M_owns = true;
+	  }
       }
 
       bool
       try_lock()
       {
-	bool __ret = false;
-	if (_M_device && !_M_owns)
-	  __ret = _M_device->try_lock();
-	else
-	  throw lock_error();
-	return __ret;
+	if (!_M_device)
+          __throw_system_error(posix_error::operation_not_permitted);
+        else if (_M_owns)
+          __throw_system_error(posix_error::resource_deadlock_would_occur);
+        else
+	  {
+	    _M_owns = _M_device->try_lock();	    
+	    return _M_owns;
+	  }
       }
 
+      template<typename _Clock, typename _Duration>
+        bool
+        try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+        {
+	  if (!_M_device)
+	    __throw_system_error(posix_error::operation_not_permitted);
+	  else if (_M_owns)
+	    __throw_system_error(posix_error::resource_deadlock_would_occur);
+	  else
+	    {
+	      _M_owns = _M_device->try_lock_until(__atime);
+	      return _M_owns;
+	    }
+	}
+      
+      template<typename _Rep, typename _Period>
+	bool
+	try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+        {
+	  if (!_M_device)
+	    __throw_system_error(posix_error::operation_not_permitted);
+	  else if (_M_owns)
+	    __throw_system_error(posix_error::resource_deadlock_would_occur);
+	  else
+	    {
+	      _M_owns = _M_device->try_lock_for(__rtime);
+	      return _M_owns;
+	    }
+	 }
+
       void
       unlock()
       {
-	if (_M_device && _M_owns)
-	  _M_device->unlock();
-	else
-	  throw lock_error();
+        if (!_M_owns)
+          __throw_system_error(posix_error::operation_not_permitted);
+        else if (_M_device)
+          {
+            _M_device->unlock();
+            _M_owns = false;
+          }
       }
-
-      template<typename _Rep, typename _Period>
-	bool
-	try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
-
-      template<typename _Clock, typename _Duration>
-	bool
-	try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
-
+      
       void
-      swap(unique_lock&& __u);
+      swap(unique_lock&& __u)
+      {
+	std::swap(_M_device, __u._M_device);
+	std::swap(_M_owns, __u._M_owns);
+      }
 
       mutex_type*
       release()
       {
 	mutex_type* __ret = _M_device;
-	_M_device = NULL;
+	_M_device = 0;
 	_M_owns = false;
 	return __ret;
       }
@@ -369,7 +574,7 @@ namespace std
       owns_lock() const
       { return _M_owns; }
 
-      operator bool () const
+      /* explicit */ operator bool () const
       { return owns_lock(); }
 
       mutex_type*
@@ -377,28 +582,28 @@ namespace std
       { return _M_device; }
 
     private:
-      unique_lock(unique_lock const&);
-      unique_lock& operator=(unique_lock const&);
-
       mutex_type*	_M_device;
       bool		_M_owns; // XXX use atomic_bool
     };
 
   template<typename _Mutex>
-    void
-    swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y);
+    inline void
+    swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y)
+    { __x.swap(__y); }
 
   template<typename _Mutex>
-    void
-    swap(unique_lock<_Mutex>&& __x, unique_lock<_Mutex>& __y);
+    inline void
+    swap(unique_lock<_Mutex>&& __x, unique_lock<_Mutex>& __y)
+    { __x.swap(__y); }
 
   template<typename _Mutex>
-    void
-    swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>&& __y);
+    inline void
+    swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>&& __y)
+    { __x.swap(__y); }
 
   template<typename _L1, typename _L2, typename ..._L3>
     int
-    try_lock(_L1&, _L2&, _L3&...);
+    try_lock(_L1& __l1, _L2& __l2, _L3&... __l3);
 
   template<typename _L1, typename _L2, typename ..._L3>
     void
@@ -410,30 +615,63 @@ namespace std
     typedef __gthread_once_t __native_type;
 
     once_flag()
-    {
-      __native_type __tmp = __GTHREAD_ONCE_INIT;
-      _M_once = __tmp;
-    }
+    : _M_once(__GTHREAD_ONCE_INIT)
+    { }
+    
+    once_flag(const once_flag&) = delete;
+    once_flag& operator=(const once_flag&) = delete;
 
-    __native_type&
-    _M_get() { return _M_once; }
+    template<typename _Callable, typename... _Args>
+      friend void
+      call_once(once_flag& __once, _Callable __f, _Args&&... __args);
 
   private:
     __native_type  _M_once;
-    once_flag(const once_flag&);
-    once_flag& operator=(const once_flag&);
   };
 
+#ifdef _GLIBCXX_HAVE_TLS
+  extern __thread void* __once_callable;
+  extern __thread void (*__once_call)();
+
+  template<typename _Callable>
+    void __once_call_impl()
+    {
+      (*(_Callable*)__once_callable)();
+    }
+#else
+  extern function<void()> __once_functor;
+  extern unique_lock<mutex> __once_functor_lock;
+#endif
+
+  extern "C" void __once_proxy();
+
   template<typename _Callable, typename... _Args>
     void
     call_once(once_flag& __once, _Callable __f, _Args&&... __args)
     {
-      int __e = __gthread_once(&(__once._M_get()), __f(__args...));
+#ifdef _GLIBCXX_HAVE_TLS
+      auto __bound_functor = bind(__f, __args...);
+      __once_callable = &__bound_functor;
+      __once_call = &__once_call_impl<decltype(__bound_functor)>;
+#else
+      __once_functor_lock.lock();
+      __once_functor = bind(__f, __args...);
+#endif
+     
+      int __e = __gthread_once(&(__once._M_once), &__once_proxy);
+
+#ifndef _GLIBCXX_HAVE_TLS      
+      if (__once_functor_lock)
+	__once_functor_lock.unlock();
+#endif
+
       if (__e)
 	__throw_system_error(__e);
     }
 }
 
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
 #endif // __GXX_EXPERIMENTAL_CXX0X__
 
 #endif // _GLIBCXX_MUTEX
diff --git a/libstdc++-v3/src/condition_variable.cc b/libstdc++-v3/src/condition_variable.cc
index c3caa593a0d69f74dccbb3493e5f6f5135b5ea76..f1ae33a9bab854ae12c37a5d2e00b106406eb8f1 100644
--- a/libstdc++-v3/src/condition_variable.cc
+++ b/libstdc++-v3/src/condition_variable.cc
@@ -29,56 +29,80 @@
 
 #include <condition_variable>
 
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
 namespace std
 {
   condition_variable::condition_variable()
   {
-#if __GTHREAD_HAS_COND
-# if defined __GTHREAD_COND_INIT
-    native_handle_type __tmp = __GTHREAD_COND_INIT;
+#ifdef __GTHREAD_COND_INIT
+    __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
     _M_cond = __tmp;
-# else
+#else
     int __e = __gthread_cond_init(&_M_cond, NULL);
-    if ( __e)
+
+    if (__e)
       __throw_system_error(__e);
-# endif
 #endif
   }
 
   condition_variable::~condition_variable()
   {
-#if __GTHREAD_HAS_COND
     // XXX no thread blocked
-    /* int __e = */ pthread_cond_destroy(&_M_cond);
+    /* int __e = */ __gthread_cond_destroy(&_M_cond);
     // if __e == EBUSY then blocked
-#endif
   }
 
+  void
+  condition_variable::wait(unique_lock<mutex>& __lock)
+  {
+    int __e = __gthread_cond_wait(&_M_cond, __lock.mutex()->native_handle());
+
+    if (__e)
+      __throw_system_error(__e);    
+  }
+  
   void 
   condition_variable::notify_one()
   { 
-#if __GTHREAD_HAS_COND
-    int __e = pthread_cond_signal(&_M_cond);
+    lock_guard<mutex> __lock(_M_internal_mutex);
+    int __e = __gthread_cond_signal(&_M_cond);
 
     // XXX not in spec
     // EINVAL
-    if ( __e)
+    if (__e)
       __throw_system_error(__e);
-#endif
   }
 
   void 
   condition_variable::notify_all()
   { 
-#if __GTHREAD_HAS_COND
-    int __e = pthread_cond_broadcast(&_M_cond);
+    lock_guard<mutex> __lock(_M_internal_mutex);
+    int __e = __gthread_cond_broadcast(&_M_cond);
 
     // XXX not in spec
     // EINVAL
-    if ( __e)
+    if (__e)
       __throw_system_error(__e);
-#endif
   }
 
+  condition_variable_any::condition_variable_any()
+  {
+#ifdef __GTHREAD_COND_INIT
+    __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
+    _M_cond = __tmp;
+#else
+    int __e = __gthread_cond_init(&_M_cond, NULL);
+
+    if (__e)
+      __throw_system_error(__e);
+#endif
+  }
+  
+  condition_variable_any::~condition_variable_any()
+  {
+    __gthread_cond_destroy(&_M_cond);
+  } 
 }
 
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/mutex.cc b/libstdc++-v3/src/mutex.cc
index a1c74aab101c976e090f0bed6e459ab77f37b748..8fae0302fda0686476bcb8d838a59478c968275d 100644
--- a/libstdc++-v3/src/mutex.cc
+++ b/libstdc++-v3/src/mutex.cc
@@ -29,6 +29,8 @@
 
 #include <mutex>
 
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
 namespace std
 {
   const defer_lock_t defer_lock = defer_lock_t();
@@ -38,5 +40,29 @@ namespace std
   const char*
   lock_error::what() const throw()
   { return "std::lock_error"; }
+
+#ifdef _GLIBCXX_HAVE_TLS
+  __thread void* __once_callable;
+  __thread void (*__once_call)();
+#else
+  // explicit instantiation due to -fno-implicit-instantiation
+  template class function<void()>;
+  function<void()> __once_functor;
+  mutex __once_mutex;
+  unique_lock<mutex> __once_functor_lock(__once_mutex, defer_lock);
+#endif
+
+  extern "C"
+  {
+    void __once_proxy()
+    {
+#ifndef _GLIBCXX_HAVE_TLS
+      function<void()> __once_call = std::move(__once_functor);
+      __once_functor_lock.unlock();
+#endif
+      __once_call();
+    }
+  }
 }
 
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc b/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..00e4502a324e9929cf7a07efbdc658943b3e852a
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc
@@ -0,0 +1,68 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+std::once_flag value_flag;
+int value = 1;
+
+void add_to_value(int i)
+{
+  value += i;
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  try 
+    {
+      std::call_once(value_flag, add_to_value, 2);
+      std::call_once(value_flag, add_to_value, 2);
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  VERIFY( value == 3 );
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/call_once/once_flag.cc b/libstdc++-v3/testsuite/30_threads/call_once/once_flag.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d972c3c3b41754258b93cc05859a41f3e3d5fd07
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/call_once/once_flag.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  std::once_flag once_flag;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4ddbd7ec4fd38708be7a3ab8536ca16ec3a5ad40
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc
@@ -0,0 +1,57 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  try 
+    {
+      std::condition_variable c1;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..331a8146ca82a86a620cc0c166ed54709c92442c
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+
+void test01()
+{
+  // assign
+  std::condition_variable c1;
+  std::condition_variable c2;
+  c1 = c2;
+}
+
+// { dg-error "used here" "" { target *-*-* } 40 }
+// { dg-error "deleted function" "" { target *-*-* } 60 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..329279f8926c97276bf28cbbfdd66519c48f4bcc
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+
+void test01()
+{
+  // copy
+  std::condition_variable c1;
+  std::condition_variable c2(c1);
+}
+
+// { dg-error "used here" "" { target *-*-* } 39 }
+// { dg-error "deleted function" "" { target *-*-* } 59 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d69ed765efab10ca71f22d04d648ebef1131c905
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc
@@ -0,0 +1,57 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  try 
+    {
+      std::condition_variable_any c1;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7cdd252a59ae9fe18ef883071162ab2e0fae3877
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+
+void test01()
+{
+  // assign
+  std::condition_variable_any c1;
+  std::condition_variable_any c2;
+  c1 = c2;
+}
+
+// { dg-error "used here" "" { target *-*-* } 40 }
+// { dg-error "deleted function" "" { target *-*-* } 168 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d71e955800da55abf08893d106417f9629d8058d
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
@@ -0,0 +1,43 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <condition_variable>
+
+void test01()
+{
+  // copy
+  std::condition_variable_any c1;
+  std::condition_variable_any c2(c1);
+}
+
+// { dg-error "used here" "" { target *-*-* } 39 }
+// { dg-error "deleted function" "" { target *-*-* } 167 }
diff --git a/libstdc++-v3/testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc b/libstdc++-v3/testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc
index 8c15bb57e7d3d90ee7336955007e012d3ce79901..7c30499a74ddcbaedcdfe2c764d42c303f911f44 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/condition_variable/types_std_c++0x.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/headers/mutex/types_std_c++0x.cc b/libstdc++-v3/testsuite/30_threads/headers/mutex/types_std_c++0x.cc
index 6296f92d1163116ac8ab8a92ee30497a988c498d..c5ef4061cff8806656787de1ca151052dbf3e423 100644
--- a/libstdc++-v3/testsuite/30_threads/headers/mutex/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/30_threads/headers/mutex/types_std_c++0x.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" } 
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/explicit_instantiation.cc
index 51bee1b2ac9d5c77818e5be9fb628621111d9b93..ec9598778c2f24e397f60c4dbf98ee7b22db1d89 100644
--- a/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/explicit_instantiation.cc
@@ -1,5 +1,8 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" } 
+// { dg-require-gthreads "" }
+
 // 2008-03-14 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/typedefs.cc
index f38ee5dc77123d735582b569fe8dfea4e07b2ad8..e4be75ec7844e45d2862e23f2b6b1f0fb6fe06a5 100644
--- a/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/lock_guard/requirements/typedefs.cc
@@ -1,5 +1,8 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" } 
+// { dg-require-gthreads "" }
+
 // 2008-03-14 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc
index 3ed9b6ebecc678ffe9d0ac6681e687bb877a258a..1f5f086d271ac5a6f6eb8f65f88b41c7ab970dad 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
index 8c66bb53cd7f2c0a9bc275c86896d3e4e21f7446..388743dfb6711d2ee841ed7dbbd4e30fa4ce395a 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -38,5 +40,6 @@ void test01()
   mutex_type m2;
   m1 = m2;
 }
-// { dg-error "within this context" "" { target *-*-* } 39 } 
-// { dg-error "is private" "" { target *-*-* } 108 } 
+
+// { dg-error "used here" "" { target *-*-* } 41 }
+// { dg-error "deleted function" "" { target *-*-* } 76 }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
index 666506a36b14009b211d77fae5c7df13e7fa24a6..37daed3611d31529f7e50a2e0e049608a9e41a03 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -37,5 +39,6 @@ void test01()
   mutex_type m1;
   mutex_type m2(m1);
 }
-// { dg-error "within this context" "" { target *-*-* } 38 } 
-// { dg-error "is private" "" { target *-*-* } 107 } 
+
+// { dg-error "used here" "" { target *-*-* } 40 }
+// { dg-error "deleted function" "" { target *-*-* } 75 }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc
index 3fe33b2ca34097837ccf281828d946dffcc14004..76a585cc0efc040f4e1aa0fc1337d1ff92529772 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc
index c63c606ebc06c826d5d594fc4250eb754499431f..3b22953b572a550afdac756c871add0652a7030d 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc
index d4cd9f7a2e428c6dffe31ce7cf903aef8167e0c6..97eadb5e0defe75989d93e745140f84d7524072a 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -41,6 +45,7 @@ int main()
     {
       mutex_type m;
       mutex_type::native_handle_type n = m.native_handle();
+      (void)n;
     }
   catch (const std::system_error& e)
     {
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc
index 225539958de9b908ee3f90787d6015b7a65ed424..358e8f31a318cf5f50538d702a60a08ac80cfd8e 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 // 2008-03-18 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc
index b7380d65717d7cf19ec629ba3c4a85184374c7fe..d67e356122afea72585f8121c06917aaf93db9e1 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
index 7c7845edf5b687666b941c2441ce7b0ad2270a3b..e5d43cdfebd19369711c5c15277ec02eff25db9c 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc
index 4c845fa4592182b3a0bcc258e1b0706b8e2f0d1b..695b69b9a662343fb1f2a9d867491dc5bc7d2ee7 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc
index 1125ea624001c0d8d056e6aa41128f22cc5daa62..f322edafffc95ce911e3f5720bf3c292023a33c5 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
index b7e27847667f0326a6331451f13648b0becb1b64..1ca7f1c6c5d2492a32ecd7899eb5e8b4d0ef7e5a 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -38,5 +40,6 @@ void test01()
   mutex_type m2;
   m1 = m2;
 }
-// { dg-error "within this context" "" { target *-*-* } 39 } 
-// { dg-error "is private" "" { target *-*-* } 160 } 
+
+// { dg-error "used here" "" { target *-*-* } 41 } 
+// { dg-error "deleted function" "" { target *-*-* } 128 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
index 2d20cb98c3df149fa9c9f1cf416bbd0c39f7a174..d7322453c5cf98440d203e525b9956395c438a1a 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
@@ -1,5 +1,7 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -37,5 +39,6 @@ void test01()
   mutex_type m1;
   mutex_type m2(m1);
 }
-// { dg-error "within this context" "" { target *-*-* } 38 } 
-// { dg-error "is private" "" { target *-*-* } 159 } 
+
+// { dg-error "used here" "" { target *-*-* } 40 } 
+// { dg-error "deleted function" "" { target *-*-* } 127 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc
index 464d1a80035377b68b6808d0352297350cba3b48..ac22512ff504c972505e63184adf3b273d9adf67 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc
index fb3be90deb3ca688c8287f6ae2cc741fc0e0f32d..ba495ff85fab532fadac5e6c4acf27fc4baa49ac 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc
@@ -1,5 +1,9 @@
-// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } }
-// { dg-options "-pthread -std=gnu++0x" }
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
 //
@@ -41,6 +45,7 @@ int main()
     {
       mutex_type m;
       mutex_type::native_handle_type n = m.native_handle();
+      (void)n;
     }
   catch (const std::system_error& e)
     {
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/requirements/typedefs.cc
index 6b7c3cf724cae9be1c6b71a8dd20849cc8df41a5..81ce7c33b4aaa3873f4067703ac6e23f89856d5e 100644
--- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/requirements/typedefs.cc
@@ -1,5 +1,8 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
 // 2008-03-18 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..20f7f07efafe6e0689368619e629c8295ba3b2e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc
@@ -0,0 +1,58 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m1;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..28320937ec88d8eaa2c638c715facd1bbd5097cd
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // assign
+  typedef std::recursive_timed_mutex mutex_type;
+  mutex_type m1;
+  mutex_type m2;
+  m1 = m2;
+}
+
+// { dg-error "used here" "" { target *-*-* } 41 } 
+// { dg-error "deleted function" "" { target *-*-* } 282 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..95eda1f3939ab0a6017be95cbef89615dd117a54
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // assign
+  typedef std::recursive_timed_mutex mutex_type;
+  mutex_type m1;
+  mutex_type m2(m1);
+}
+
+// { dg-error "used here" "" { target *-*-* } 40 } 
+// { dg-error "deleted function" "" { target *-*-* } 281 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc
new file mode 100644
index 0000000000000000000000000000000000000000..df9588c1429921df568720ab5813bd14ff57e30d
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc
@@ -0,0 +1,60 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+    }
+  catch (const std::system_error& e)
+    {
+      // Destroying locked mutex raises system error, or undefined.
+      // POSIX == may fail with EBUSY.
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0599797ce9830172a3f871f78a571241289bd594
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+
+      // Lock already locked mutex.
+      try
+	{
+	  // XXX Will block.
+	  // m.lock();
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..311149377b5c8466940e17dcf8b164e2b1cac507
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+
+      // Lock already locked mutex.
+      try
+	{
+	  // XXX Will not block.
+	  // m.lock();
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39c67efc5518c62a43176397842a1c2b607629c6
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc
@@ -0,0 +1,60 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      mutex_type::native_handle_type n = m.native_handle();
+      (void)n;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fd323fe5d35090773d1781c644b626a7f5afeafa
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// 2008-03-18 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::recursive_timed_mutex test_type;
+  typedef test_type::native_handle_type type;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..96536482dc59546884244c418a92bd3ef09d2d43
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock();
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..36ca9c0cde6b058241117ecb21aadee9e2b3b0a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc
@@ -0,0 +1,73 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options "-std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options "-std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock();
+	  VERIFY( b );
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3f278a6522239e15b92cd7dae1e22f5216791578
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc
@@ -0,0 +1,62 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <chrono>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+  
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock_for(std::chrono::seconds(1));
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f93a8b64cabc03aa1a592c148c0ac0546f1d1181
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc
@@ -0,0 +1,63 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <chrono>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+  typedef std::chrono::duration<int64_t, std::pico> picoseconds;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock_for(picoseconds(1));
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc
new file mode 100644
index 0000000000000000000000000000000000000000..530a084a50d4c86d30c2444b049f581580d5260f
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc
@@ -0,0 +1,79 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  std::chrono::seconds s(1);
+  
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock_for(s);
+	  VERIFY( b );
+	  m.unlock();
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+      catch(...)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..96536482dc59546884244c418a92bd3ef09d2d43
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock();
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d3eda2f923d795cc69d337f20f8760e63a38354b
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock();
+	  VERIFY( b );
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c7136854f1712799436cc8947c5358dc32b6d851
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::recursive_timed_mutex mutex_type;
+
+  try 
+    {
+      // Unlock mutex that hasn't been locked.
+      mutex_type m;
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      // POSIX == EPERM
+      VERIFY( true );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4d36b83c08a119d08de9937798f2f0cae5d917f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc
@@ -0,0 +1,58 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m1;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..719ef0cb24a64d671ba16b6e261a774fccb7cb40
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
@@ -0,0 +1,45 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // assign
+  typedef std::timed_mutex mutex_type;
+  mutex_type m1;
+  mutex_type m2;
+  m1 = m2;
+}
+
+// { dg-error "used here" "" { target *-*-* } 41 } 
+// { dg-error "deleted function" "" { target *-*-* } 179 }
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
new file mode 100644
index 0000000000000000000000000000000000000000..20f309e9bb5e961a4fc8a349cdcca7b746204d6e
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // assign
+  typedef std::timed_mutex mutex_type;
+  mutex_type m1;
+  mutex_type m2(m1);
+}
+
+// { dg-error "used here" "" { target *-*-* } 40 } 
+// { dg-error "deleted function" "" { target *-*-* } 178 }
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9f78c63305d19e791858e9f952965018580e3a77
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc
@@ -0,0 +1,60 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+    }
+  catch (const std::system_error& e)
+    {
+      // Destroying locked mutex raises system error, or undefined.
+      // POSIX == may fail with EBUSY.
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c94760d90ea35fde92f7af06c01d5cb07c6f5a76
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+
+      // Lock already locked mutex.
+      try
+	{
+	  // XXX Will block.
+	  // m.lock();
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..34db1e9dbe56c7ed8b32f0011dc4b07f189f2dbf
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc
@@ -0,0 +1,60 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      mutex_type::native_handle_type n = m.native_handle();
+      (void)n;
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/typedefs.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2447c957eb929e1d81a15caf8a2214b6fb889812
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/typedefs.cc
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// 2008-07-23 Chris Fairles <chris.fairles@gmail.com>
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::timed_mutex test_type;
+  typedef test_type::native_handle_type type;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2823c371754381ade3753d786935e42e2615b565
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock();
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c264675b61ffe509f227d2a564d61ffca84167f
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock();
+	  VERIFY( !b );
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d761b9668a62c3166e4cd42c07c275d02256960
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc
@@ -0,0 +1,62 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <chrono>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+  
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock_for(std::chrono::seconds(1));
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6463281ef82b2871d754ea78a1438d0850fe94c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc
@@ -0,0 +1,63 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <chrono>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+  typedef std::chrono::duration<int64_t, std::pico> picoseconds;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock_for(picoseconds(1));
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eeb330dc6c951d10002f02648c5892928582e27d
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc
@@ -0,0 +1,74 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  std::chrono::seconds s(1);
+  
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock_for(s);
+	  VERIFY( !b );
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2823c371754381ade3753d786935e42e2615b565
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      bool b = m.try_lock();
+      VERIFY( b );
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c264675b61ffe509f227d2a564d61ffca84167f
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      mutex_type m;
+      m.lock();
+      bool b;
+
+      try
+	{
+	  b = m.try_lock();
+	  VERIFY( !b );
+	}
+      catch (const std::system_error& e)
+	{
+	  VERIFY( false );
+	}
+
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      VERIFY( false );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7c118bf500ad4499272f518d885b7718dea03351
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc
@@ -0,0 +1,61 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  typedef std::timed_mutex mutex_type;
+
+  try 
+    {
+      // Unlock mutex that hasn't been locked.
+      mutex_type m;
+      m.unlock();
+    }
+  catch (const std::system_error& e)
+    {
+      // POSIX == EPERM
+      VERIFY( true );
+    }
+  catch (...)
+    {
+      VERIFY( false );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/explicit_instantiation.cc
index 594d8291a09d192735eeb3302349291d5feaf10d..5e9272988b79641efe112fa42505b2a5ed3180b6 100644
--- a/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/explicit_instantiation.cc
@@ -1,5 +1,8 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
 // 2008-03-14 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/typedefs.cc
index 5933afe8d0d597a57f862ce00114be22d9403b7c..a4939873ea8dbc6fa75797d854b20adc639263d1 100644
--- a/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/unique_lock/requirements/typedefs.cc
@@ -1,5 +1,8 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
 // 2008-03-14 Benjamin Kosnik <bkoz@redhat.com>
 
 // Copyright (C) 2008 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 44dea8073026abf058fdad78975e078cfb827b8c..927aa47a58c6aeac6dad8170211744221b48343e 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -106,3 +106,12 @@ proc dg-require-atomic-builtins { args } {
     }
     return
 }
+
+proc dg-require-gthreads { args } {
+    if { ![ check_v3_target_gthreads ] } {
+        upvar dg-do-what dg-do-what
+        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+        return
+    }
+    return
+}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 45b6fb27f2cdcbf8cda29653f8edf7d80857f793..23060b4cc866b6a62bca0f144f27096c42172a54 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1091,7 +1091,7 @@ proc check_v3_target_atomic_builtins { } {
 	set et_atomic_builtins 0
 
 	# Set up and compile a C++0x test program that depends
-	# on the C99 stdint facilities to be available.
+	# on the atomic builtin facilities to be available.
 	set src atomic_builtins[pid].cc
 	set exe atomic_builtins[pid].exe
 
@@ -1120,3 +1120,61 @@ proc check_v3_target_atomic_builtins { } {
     verbose "check_v3_target_atomic_builtins: $et_atomic_builtins" 2
     return $et_atomic_builtins
 }
+
+proc check_v3_target_gthreads { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_gthreads
+
+    global tool
+
+    if { ![info exists et_gthreads_target_name] } {
+        set et_gthreads_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_gthreads_target_name } {
+        verbose "check_v3_target_gthreads: `$et_gthreads_target_name'" 2
+        set et_gthreads_target_name $current_target
+        if [info exists et_gthreads] {
+            verbose "check_v3_target_gthreads: removing cached result" 2
+            unset et_gthreads
+        }
+    }
+
+    if [info exists et_gthreads] {
+        verbose "check_v3_target_gthreads: using cached result" 2
+    } else {
+        set et_gthreads 0
+
+        # Set up and compile a C++0x test program that depends
+        # on the gthreads facilities to be available.
+        set src gthreads[pid].cc
+        set exe gthreads[pid].exe
+
+        set f [open $src "w"]
+	puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#ifdef _GLIBCXX_HAS_GTHREADS"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_gthreads 1
+        } else {
+            verbose "check_v3_target_gthreads: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_gthreads: $et_gthreads" 2
+    return $et_gthreads
+}