From 7b800287b74501a98bf859cf13f46eb562ba876c Mon Sep 17 00:00:00 2001
From: Chris Fairles <chris.fairles@gmail.com>
Date: Wed, 3 Sep 2008 17:46:09 +0000
Subject: [PATCH] condition_variable: Use new deleted ctors.

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.

From-SVN: r139943
---
 libstdc++-v3/ChangeLog                        | 108 +++++
 libstdc++-v3/config/abi/pre/gnu.ver           |  12 +
 libstdc++-v3/include/std/condition_variable   | 100 ++--
 libstdc++-v3/include/std/mutex                | 442 ++++++++++++++----
 libstdc++-v3/src/condition_variable.cc        |  58 ++-
 libstdc++-v3/src/mutex.cc                     |  26 ++
 .../30_threads/call_once/call_once1.cc        |  68 +++
 .../30_threads/call_once/once_flag.cc         |  38 ++
 .../30_threads/condition_variable/cons/1.cc   |  57 +++
 .../condition_variable/cons/assign_neg.cc     |  44 ++
 .../condition_variable/cons/copy_neg.cc       |  43 ++
 .../condition_variable_any/cons/1.cc          |  57 +++
 .../condition_variable_any/cons/assign_neg.cc |  44 ++
 .../condition_variable_any/cons/copy_neg.cc   |  43 ++
 .../condition_variable/types_std_c++0x.cc     |   4 +-
 .../headers/mutex/types_std_c++0x.cc          |   4 +-
 .../requirements/explicit_instantiation.cc    |   5 +-
 .../lock_guard/requirements/typedefs.cc       |   5 +-
 .../testsuite/30_threads/mutex/cons/1.cc      |   8 +-
 .../30_threads/mutex/cons/assign_neg.cc       |   9 +-
 .../30_threads/mutex/cons/copy_neg.cc         |   9 +-
 .../mutex/dest/destructor_locked.cc           |   8 +-
 .../testsuite/30_threads/mutex/lock/1.cc      |   8 +-
 .../30_threads/mutex/native_handle/1.cc       |   9 +-
 .../30_threads/mutex/requirements/typedefs.cc |   4 +-
 .../testsuite/30_threads/mutex/try_lock/1.cc  |   8 +-
 .../testsuite/30_threads/mutex/try_lock/2.cc  |   8 +-
 .../testsuite/30_threads/mutex/unlock/1.cc    |   8 +-
 .../30_threads/recursive_mutex/cons/1.cc      |   8 +-
 .../recursive_mutex/cons/assign_neg.cc        |   9 +-
 .../recursive_mutex/cons/copy_neg.cc          |   9 +-
 .../recursive_mutex/dest/destructor_locked.cc |   8 +-
 .../recursive_mutex/native_handle/1.cc        |   9 +-
 .../recursive_mutex/requirements/typedefs.cc  |   5 +-
 .../recursive_timed_mutex/cons/1.cc           |  58 +++
 .../recursive_timed_mutex/cons/assign_neg.cc  |  45 ++
 .../recursive_timed_mutex/cons/copy_neg.cc    |  44 ++
 .../dest/destructor_locked.cc                 |  60 +++
 .../recursive_timed_mutex/lock/1.cc           |  72 +++
 .../recursive_timed_mutex/lock/2.cc           |  72 +++
 .../recursive_timed_mutex/native_handle/1.cc  |  60 +++
 .../requirements/typedefs.cc                  |  42 ++
 .../recursive_timed_mutex/try_lock/1.cc       |  61 +++
 .../recursive_timed_mutex/try_lock/2.cc       |  73 +++
 .../recursive_timed_mutex/try_lock_for/1.cc   |  62 +++
 .../recursive_timed_mutex/try_lock_for/2.cc   |  63 +++
 .../recursive_timed_mutex/try_lock_for/3.cc   |  79 ++++
 .../recursive_timed_mutex/try_lock_until/1.cc |  61 +++
 .../recursive_timed_mutex/try_lock_until/2.cc |  72 +++
 .../recursive_timed_mutex/unlock/1.cc         |  61 +++
 .../30_threads/timed_mutex/cons/1.cc          |  58 +++
 .../30_threads/timed_mutex/cons/assign_neg.cc |  45 ++
 .../30_threads/timed_mutex/cons/copy_neg.cc   |  44 ++
 .../timed_mutex/dest/destructor_locked.cc     |  60 +++
 .../30_threads/timed_mutex/lock/1.cc          |  72 +++
 .../30_threads/timed_mutex/native_handle/1.cc |  60 +++
 .../timed_mutex/requirements/typedefs.cc      |  42 ++
 .../30_threads/timed_mutex/try_lock/1.cc      |  61 +++
 .../30_threads/timed_mutex/try_lock/2.cc      |  72 +++
 .../30_threads/timed_mutex/try_lock_for/1.cc  |  62 +++
 .../30_threads/timed_mutex/try_lock_for/2.cc  |  63 +++
 .../30_threads/timed_mutex/try_lock_for/3.cc  |  74 +++
 .../timed_mutex/try_lock_until/1.cc           |  61 +++
 .../timed_mutex/try_lock_until/2.cc           |  72 +++
 .../30_threads/timed_mutex/unlock/1.cc        |  61 +++
 .../requirements/explicit_instantiation.cc    |   5 +-
 .../unique_lock/requirements/typedefs.cc      |   5 +-
 libstdc++-v3/testsuite/lib/dg-options.exp     |   9 +
 libstdc++-v3/testsuite/lib/libstdc++.exp      |  60 ++-
 69 files changed, 3065 insertions(+), 191 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/call_once/once_flag.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/typedefs.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0b2f5b94d637..89e0b2a7f2d2 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 0ec4879ffd4e..7f940121dc86 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 1a7a7cd1f37d..f2035d6de73b 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 779394a58914..5e6ba9c27155 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 c3caa593a0d6..f1ae33a9bab8 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 a1c74aab101c..8fae0302fda0 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 000000000000..00e4502a324e
--- /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 000000000000..d972c3c3b417
--- /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 000000000000..4ddbd7ec4fd3
--- /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 000000000000..331a8146ca82
--- /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 000000000000..329279f8926c
--- /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 000000000000..d69ed765efab
--- /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 000000000000..7cdd252a59ae
--- /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 000000000000..d71e955800da
--- /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 8c15bb57e7d3..7c30499a74dd 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 6296f92d1163..c5ef4061cff8 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 51bee1b2ac9d..ec9598778c2f 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 f38ee5dc7712..e4be75ec7844 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 3ed9b6ebecc6..1f5f086d271a 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 8c66bb53cd7f..388743dfb671 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 666506a36b14..37daed3611d3 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 3fe33b2ca340..76a585cc0efc 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 c63c606ebc06..3b22953b572a 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 d4cd9f7a2e42..97eadb5e0def 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 225539958de9..358e8f31a318 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 b7380d65717d..d67e356122af 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 7c7845edf5b6..e5d43cdfebd1 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 4c845fa45921..695b69b9a662 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 1125ea624001..f322edafffc9 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 b7e27847667f..1ca7f1c6c5d2 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 2d20cb98c3df..d7322453c5cf 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 464d1a800353..ac22512ff504 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 fb3be90deb3c..ba495ff85fab 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 6b7c3cf724ca..81ce7c33b4aa 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 000000000000..20f7f07efafe
--- /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 000000000000..28320937ec88
--- /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 000000000000..95eda1f3939a
--- /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 000000000000..df9588c14299
--- /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 000000000000..0599797ce983
--- /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 000000000000..311149377b5c
--- /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 000000000000..39c67efc5518
--- /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 000000000000..fd323fe5d350
--- /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 000000000000..96536482dc59
--- /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 000000000000..36ca9c0cde6b
--- /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 000000000000..3f278a652223
--- /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 000000000000..f93a8b64cabc
--- /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 000000000000..530a084a50d4
--- /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 000000000000..96536482dc59
--- /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 000000000000..d3eda2f923d7
--- /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 000000000000..c7136854f171
--- /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 000000000000..4d36b83c08a1
--- /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 000000000000..719ef0cb24a6
--- /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 000000000000..20f309e9bb5e
--- /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 000000000000..9f78c63305d1
--- /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 000000000000..c94760d90ea3
--- /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 000000000000..34db1e9dbe56
--- /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 000000000000..2447c957eb92
--- /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 000000000000..2823c3717543
--- /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 000000000000..4c264675b61f
--- /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 000000000000..9d761b9668a6
--- /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 000000000000..6463281ef82b
--- /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 000000000000..eeb330dc6c95
--- /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 000000000000..2823c3717543
--- /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 000000000000..4c264675b61f
--- /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 000000000000..7c118bf500ad
--- /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 594d8291a09d..5e9272988b79 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 5933afe8d0d5..a4939873ea8d 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 44dea8073026..927aa47a58c6 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 45b6fb27f2cd..23060b4cc866 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
+}
-- 
GitLab