+2008-05-06 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/condition_variable: New.
+ * include/std/mutex: New.
+ * src/condition_variable.cc: New.
+ * src/mutex.cc: New.
+ * include/bits/functexcept.h: Add __throw_system_error varients.
+ * src/functexcept.cc: Same.
+ * config/abi/pre/gnu.ver: Add exports.
+
+ * doc/xml/manual/using.xml: Add new includes.
+ * doc/doxygen/user.cfg.in: Doxygen support.
+ * doc/doxygen/doxygroups.cc: Same.
+
+ * include/Makefile.am: Add mutex, condition_variable.
+ * include/Makefile.in: Regenerated.
+ * src/Makefile.am: Add mutex.cc, condition_variable.cc.
+ * src/Makefile.in: Regenerated.
+
+ * testsuite/30_threads: New.
+ * testsuite/30_threads/lock_error: New.
+ * testsuite/30_threads/mutex: New.
+ * testsuite/30_threads/mutex/dest: New.
+ * testsuite/30_threads/mutex/dest/destructor_locked.cc: New.
+ * testsuite/30_threads/mutex/native_handle: New.
+ * testsuite/30_threads/mutex/native_handle/1.cc: New.
+ * testsuite/30_threads/mutex/cons: New.
+ * testsuite/30_threads/mutex/cons/assign_neg.cc: New.
+ * testsuite/30_threads/mutex/cons/1.cc: New.
+ * testsuite/30_threads/mutex/cons/copy_neg.cc: New.
+ * testsuite/30_threads/mutex/requirements: New.
+ * testsuite/30_threads/mutex/requirements/typedefs.cc: New.
+ * testsuite/30_threads/mutex/try_lock: New.
+ * testsuite/30_threads/mutex/try_lock/1.cc: New.
+ * testsuite/30_threads/mutex/try_lock/2.cc: New.
+ * testsuite/30_threads/mutex/lock: New.
+ * testsuite/30_threads/mutex/lock/1.cc: New.
+ * testsuite/30_threads/mutex/unlock: New.
+ * testsuite/30_threads/mutex/unlock/1.cc: New.
+ * testsuite/30_threads/recursive_mutex: New.
+ * testsuite/30_threads/recursive_mutex/dest: New.
+ * testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc: New.
+ * testsuite/30_threads/recursive_mutex/native_handle: New.
+ * testsuite/30_threads/recursive_mutex/native_handle/1.cc: New.
+ * testsuite/30_threads/recursive_mutex/cons: New.
+ * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: New.
+ * testsuite/30_threads/recursive_mutex/cons/1.cc: New.
+ * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: New.
+ * testsuite/30_threads/recursive_mutex/requirements: New.
+ * testsuite/30_threads/recursive_mutex/requirements/typedefs.cc: New.
+ * testsuite/30_threads/lock_guard: New.
+ * testsuite/30_threads/lock_guard/requirements: New.
+ * testsuite/30_threads/lock_guard/requirements/typedefs.cc: New.
+ * testsuite/30_threads/lock_guard/requirements/
+ explicit_instantiation.cc: New.
+ * testsuite/30_threads/headers: New.
+ * testsuite/30_threads/headers/mutex: New.
+ * testsuite/30_threads/headers/mutex/types_std_c++0x.cc: New.
+ * testsuite/30_threads/headers/mutex/std_c++0x_neg.cc: New.
+ * testsuite/30_threads/headers/condition_variable: New.
+ * testsuite/30_threads/headers/condition_variable/
+ types_std_c++0x.cc: New.
+ * testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc: New.
+ * testsuite/30_threads/once_flag: New.
+ * testsuite/30_threads/unique_lock: New.
+ * testsuite/30_threads/unique_lock/requirements: New.
+ * testsuite/30_threads/unique_lock/requirements/typedefs.cc: New.
+ * testsuite/30_threads/unique_lock/requirements/
+ explicit_instantiation.cc: New.
+ * testsuite/17_intro/headers/c++200x/all.cc: Add new includes.
+
2008-05-06 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36130
* include/bits/c++config: Namespace macros and setup only in C++.
* testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: New.
-
+
2008-05-06 Johannes Singler <singler@ira.uka.de>
- * include/parallel/multiway_merge.h:
- (multiway_merge_*_unguarded):
- Pass sentinel directly, to allow correct determination.
- (multiway_merge_loser_tree_unguarded):
- Remove over-cautious assertion.
- (calls to multiway_merge_*_splitting):
- Parametrize with type that is correct in all cases.
- * include/parallel/losertree.h:
- (delete_min_insert (in many classes)):
- Correct and standardize assertions.
+ * include/parallel/multiway_merge.h:
+ (multiway_merge_*_unguarded):
+ Pass sentinel directly, to allow correct determination.
+ (multiway_merge_loser_tree_unguarded):
+ Remove over-cautious assertion.
+ (calls to multiway_merge_*_splitting):
+ Parametrize with type that is correct in all cases.
+ * include/parallel/losertree.h:
+ (delete_min_insert (in many classes)):
+ Correct and standardize assertions.
2008-05-05 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust line numbers.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
-
+
2008-05-05 Benjamin Kosnik <bkoz@redhat.com>
* 20_util/make_signed/requirements/typedefs-1.cc: Correct requirements.
2008-04-23 Johannes Singler <singler@ira.uka.de>
- * include/parallel/quicksort.h: Reformat,
- (parallel_sort_qs): Do not pass number of elements.
- * include/parallel/balanced_quicksort.h: Reformat,
- (parallel_sort_qsb): Do not pass number of elements.
- * include/parallel/tags.h:
- Introduce new tags for compile-time choice.
- * include/parallel/merge.h:
- (parallel_merge_advance):Beautified.
- * include/parallel/algo.h: Reformatting (spaces for tabs)
- New sort and stable_sort variants, corresponding to the tags.
- * include/parallel/sort.h:
- New sort and stable_sort variants, corresponding to the tags.
- Changed determining the desired number of threads.
+ * include/parallel/quicksort.h: Reformat,
+ (parallel_sort_qs): Do not pass number of elements.
+ * include/parallel/balanced_quicksort.h: Reformat,
+ (parallel_sort_qsb): Do not pass number of elements.
+ * include/parallel/tags.h:
+ Introduce new tags for compile-time choice.
+ * include/parallel/merge.h:
+ (parallel_merge_advance):Beautified.
+ * include/parallel/algo.h: Reformatting (spaces for tabs)
+ New sort and stable_sort variants, corresponding to the tags.
+ * include/parallel/sort.h:
+ New sort and stable_sort variants, corresponding to the tags.
+ Changed determining the desired number of threads.
2008-04-23 Johannes Singler <singler@ira.uka.de>
- * include/parallel/multiway_merge.h
- (multiway_merge_loser_tree):
- Leave checks to callers, add precondition instead.
- (multiway_merge_loser_tree_unguarded): Likewise.
- (multiway_merge_loser_tree_sentinel): Likewise.
- (sequential_multiway_merge): Added checks for total length 0.
- (parallel_multiway_merge): Skip empty sequences.
- (multiway_merge, all variants):
- Remove temporary variable, return directly.
- (stable_multiway_merge, all variants): Likewise.
- (multiway_merge_sentinels, all variants): Likewise.
- (stable_multiway_merge_sentinels, all variants): Likewise.
- * include/parallel/multiseq_selection.h
- (multiseq_partition): More detailed assertions.
+ * include/parallel/multiway_merge.h
+ (multiway_merge_loser_tree):
+ Leave checks to callers, add precondition instead.
+ (multiway_merge_loser_tree_unguarded): Likewise.
+ (multiway_merge_loser_tree_sentinel): Likewise.
+ (sequential_multiway_merge): Added checks for total length 0.
+ (parallel_multiway_merge): Skip empty sequences.
+ (multiway_merge, all variants):
+ Remove temporary variable, return directly.
+ (stable_multiway_merge, all variants): Likewise.
+ (multiway_merge_sentinels, all variants): Likewise.
+ (stable_multiway_merge_sentinels, all variants): Likewise.
+ * include/parallel/multiseq_selection.h
+ (multiseq_partition): More detailed assertions.
2008-04-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* include/std/regex: Same.
* include/std/array: Same.
* include/std/system_error: Same, add error_code ctor.
-
+
2008-04-07 Johannes Singler <singler@ira.uka.de>
* include/parallel/multiway_merge.h: Moved decisions to
2008-03-26 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/util/testsuite_abi.h: Remove symbol_objects,
- symbol_names typedefs.
+ symbol_names typedefs.
* testsuite/util/testsuite_abi.cc (compare_symbols): Correct check
for long double compatiblity symbols, simplify data structures used.
* doc/doxygen/Intro.3: Correct typo.
* doc/xml/api.xml: Add gcc-4.3 links.
- * doc/html/api.html: Regenerate.
-
+ * doc/html/api.html: Regenerate.
+
* include/debug/debug.h: Document namepaces here.
* include/parallel/base.h: Same.
* include/ext/typelist.h: Same.
* include/ext/pb_ds/tag_and_trait.hpp: Same.
-
+
* include/tr1_impl/random: Adjust line break.
* include/tr1_impl/unordered_map: Correct and or add markup.
* include/tr1_impl/boost_shared_ptr.h: Correct and or add markup.
2008-03-20 Johannes Singler <singler@ira.uka.de>
- * include/parallel/set_operations.h (set_intersection): Remove.
+ * include/parallel/set_operations.h (set_intersection): Remove.
2008-03-19 Benjamin Kosnik <bkoz@redhat.com>
* include/std/date_time: New file.
* src/date_time.cc: New file.
- * config/abi/pre/gnu.ver: Added <date_time> symbols in version
- GLIBCXX_3.4.11 and changed two patterns in version GLIBCXX_3.4
+ * config/abi/pre/gnu.ver: Added <date_time> symbols in version
+ GLIBCXX_3.4.11 and changed two patterns in version GLIBCXX_3.4
that matched new symbols.
* include/Makefile.am: Add date_time in std headers.
* src/Makefile.am: Add date_time.cc to source files.
* testsuite/31_date_time/nanoseconds/requirements/traits.cc: Likewise.
* testsuite/31_date_time/nanoseconds/requirements/duration.cc: Likewise.
* testsuite/31_date_time/system_time/requirements: Likewise.
- * testsuite/31_date_time/system_time/requirements/traits.cc: Likewise.
+ * testsuite/31_date_time/system_time/requirements/traits.cc: Likewise.
2008-03-16 Paolo Carlini <pcarlini@suse.de>
(_GLIBCXX_LONG_DOUBLE_COMPAT_IMPL): Define.
(_ZNKSt4hashIeEclEe): New alias.
* testsuite/util/testsuite_abi.cc (check_version): Support
- GLIBCXX_LDBL_3.4.10.
+ GLIBCXX_LDBL_3.4.10.
2008-02-25 Jan Beulich <jbeulich@novell.com>
2008-02-20 Jason Merrill <jason@redhat.com>
- * include/bits/c++config: Use 'inline namespace' instead of
+ * include/bits/c++config: Use 'inline namespace' instead of
strong using.
2008-02-18 Pedro Lamarao <pedro.lamarao@mndfck.org>
* include/tr1/exp_integral.tcc: Same.
* include/tr1/gamma.tcc: Same.
* include/tr1/hypergeometric.tcc: Same.
-
+
2008-02-17 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/34797
* include/parallel/settings.h (_Settings): Reconstruct Settings class
here, uglify, remove anonymous namespace and static
- members. Convert to datum.
+ members. Convert to datum.
* include/parallel/types.h: Move Settings:: enumerations here, uglify.
* src/parallel_settings.cc: New, definition for _Settings member
- functions.
+ functions.
* include/parallel/multiway_merge.h: Same.
* include/parallel/for_each.h: Same.
* include/parallel/workstealing.h: Same.
* src/Makefile.am (parallel_sources): Add parallel_settings.cc.
* src/Makefile.in: Regenerate.
-
+
* config/abi/pre/gnu.ver: Export _Settings::get and _Settings::set.
2008-02-17 Paolo Carlini <pcarlini@suse.de>
* config/abi/pre/gnu.ver: Export stdio_sync_filebuf symbols.
* testsuite/ext/stdio_sync_filebuf/char/35209.cc: New.
* testsuite/ext/stdio_sync_filebuf/wchar_t/35209.cc: Likewise.
-
+
2008-02-16 Benjamin Kosnik <bkoz@redhat.com>
* include/parallel/random_number.h: Use TR1's mersenne_twister.
(random_number::genrand_bits()): Remove.
(random_number::set_seed): Remove.
-
+
2008-02-15 Benjamin Kosnik <bkoz@redhat.com>
-
+
* include/parallel/types.h: Remove enum parallelism.
-
+
2008-02-15 Benjamin Kosnik <bkoz@redhat.com>
* include/parallel/types.h: Move enum parallelism here. Use
tr1/cstdint's int16_t, uint16_t, int32_t, uint32_t, int64_t,
- uint64_t.
+ uint64_t.
* include/parallel/multiseq_selection.h: Adjust for cstdint.
* include/parallel/compatibility.h: Same.
* include/parallel/tags.h: Just compile-time tags.
* testsuite/tr1/6_containers/tuple/cons/constructor.cc: Likewise.
* testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc:
Likewise.
- * testsuite/tr1/6_containers/array/requirements/contiguous.cc:
+ * testsuite/tr1/6_containers/array/requirements/contiguous.cc:
Likewise.
* testsuite/tr1/6_containers/array/requirements/member_swap.cc:
Likewise.
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
- Adjust, use __glibcxx_requires_sorted_set* instead.
+ Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
2008-01-09 Paolo Carlini <pcarlini@suse.de>
* include/parallel/algobase.h: Likewise.
* include/parallel/find.h: Likewise.
* include/parallel/algo.h: Likewise.
- * include/parallel/checkers.h: Likewise.
+ * include/parallel/checkers.h: Likewise.
2008-01-09 Francesco Biscani <bluescarni@gmail.com>
* include/parallel/multiway_mergesort.h (parallel_sort_mwms_pu,
parallel_sort_mwms): Likewise.
* include/parallel/partial_sum.h (parallel_partial_sum_linear):
- Likewise.
+ Likewise.
* testsuite/25_algorithms/sort/34095.cc: New.
2008-01-01 Paolo Carlini <pcarlini@suse.de>
std::c[a-g]*;
# std::char_traits;
# std::c[i-z]*;
- std::c[i-s]*;
+ std::c[i-n]*;
+# std::condition_variable;
+ std::co[^n]*;
+ std::c[p-s]*;
std::c[u-z]*;
# std::[d-g]*;
std::d[a-d]*;
atomic_flag_test_and_set;
atomic_flag_test_and_set_explicit;
atomic_global_fence_compatibility;
+
+ # mutex
+ _ZSt10adopt_lock;
+ _ZSt10defer_lock;
+ _ZSt11try_to_lock;
+
+ _ZTISt10lock_error;
+ _ZTVSt10lock_error;
+ _ZTSSt10lock_error;
+ _ZNKSt10lock_error4whatEv;
+
+ # condition_variable
+ _ZNSt18condition_variable10notify_allEv;
+ _ZNSt18condition_variable10notify_oneEv;
+ _ZNSt18condition_variableC1Ev;
+ _ZNSt18condition_variableC2Ev;
+ _ZNSt18condition_variableD1Ev;
+ _ZNSt18condition_variableD2Ev;
# system_error
_ZSt15system_category;
_ZNKSt4hashISt10error_codeEclES0_;
+ _ZSt20__throw_system_errorPKc;
+ _ZSt20__throw_system_errori;
+
# date_time
_ZSt15get_system_timev;
/** @namespace std::placeholders
* @brief ISO C++ 0x entities sub namespace for functional.
*/
+/** @namespace std::this_thread
+ * @brief ISO C++ 0x entities sub namespace for thread.
+*/
/** @namespace __gnu_cxx
* @brief GNU extensions for public use.
*/
include/algorithm \
include/array \
include/bitset \
+ include/condition_variable \
include/date_time \
include/deque \
include/fstream \
include/locale \
include/map \
include/memory \
+ include/mutex \
include/numeric \
include/ostream \
include/queue \
include/streambuf \
include/string \
include/system_error \
+ include/thread \
include/tuple \
include/type_traits \
include/unordered_map \
include/csetjmp \
include/csignal \
include/cstdarg \
+ include/cstdatomic \
include/cstdbool \
include/cstddef \
include/cstdint \
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
-PREDEFINED = __GTHREADS \
+PREDEFINED = __cplusplus \
+ __GTHREADS \
"_GLIBCXX_STD_P= " \
"_GLIBCXX_STD_D= " \
_GLIBCXX_STD=std \
<row><entry><filename class="headerfile">exception</filename></entry><entry><filename class="headerfile">iterator</filename></entry><entry><filename class="headerfile">ostream</filename></entry><entry><filename class="headerfile">streambuf</filename></entry><entry><filename class="headerfile">utility</filename></entry></row>
<row><entry><filename class="headerfile">fstream</filename></entry><entry><filename class="headerfile">limits</filename></entry><entry><filename class="headerfile">queue</filename></entry><entry><filename class="headerfile">string</filename></entry><entry><filename class="headerfile">valarray</filename></entry></row>
<row><entry><filename class="headerfile">functional</filename></entry><entry><filename class="headerfile">list</filename></entry><entry><filename class="headerfile">random</filename></entry><entry><filename class="headerfile">system_error</filename></entry><entry><filename class="headerfile">vector</filename></entry></row>
+<row><entry><filename class="headerfile">condition_variable</filename></entry><entry><filename class="headerfile">mutex</filename></entry><entry><filename class="headerfile">thread</filename></entry><entry></entry><entry></entry></row>
</tbody>
</tgroup>
</table>
<row><entry><filename class="headerfile">cctype</filename></entry><entry><filename class="headerfile">ciso646</filename></entry><entry><filename class="headerfile">csignal</filename></entry><entry><filename class="headerfile">cstdio</filename></entry><entry><filename class="headerfile">cuchar</filename></entry></row>
<row><entry><filename class="headerfile">cerrno</filename></entry><entry><filename class="headerfile">climits</filename></entry><entry><filename class="headerfile">cstdarg</filename></entry><entry><filename class="headerfile">cstdlib</filename></entry><entry><filename class="headerfile">cwchar</filename></entry></row>
<row><entry><filename class="headerfile">cfenv</filename></entry><entry><filename class="headerfile">clocale</filename></entry><entry><filename class="headerfile">cstdbool</filename></entry><entry><filename class="headerfile">cstring</filename></entry><entry><filename class="headerfile">cwctype</filename></entry></row>
+<row><entry><filename class="headerfile">cstdatomic</filename></entry><entry></entry><entry></entry><entry></entry><entry></entry></row>
</tbody>
</tgroup>
</table>
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
${std_srcdir}/complex \
+ ${std_srcdir}/condition_variable \
${std_srcdir}/date_time \
${std_srcdir}/deque \
${std_srcdir}/fstream \
${std_srcdir}/locale \
${std_srcdir}/map \
${std_srcdir}/memory \
+ ${std_srcdir}/mutex \
${std_srcdir}/numeric \
${std_srcdir}/ostream \
${std_srcdir}/queue \
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
${std_srcdir}/complex \
+ ${std_srcdir}/condition_variable \
${std_srcdir}/date_time \
${std_srcdir}/deque \
${std_srcdir}/fstream \
${std_srcdir}/locale \
${std_srcdir}/map \
${std_srcdir}/memory \
+ ${std_srcdir}/mutex \
${std_srcdir}/numeric \
${std_srcdir}/ostream \
${std_srcdir}/queue \
// Function-Based Exception Support -*- C++ -*-
-// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2004, 2005, 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
void
__throw_underflow_error(const char*) __attribute__((__noreturn__));
+ void
+ __throw_system_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_system_error(int) __attribute__((__noreturn__));
+
// Helpers for exception objects in basic_ios
void
__throw_ios_failure(const char*) __attribute__((__noreturn__));
--- /dev/null
+// <condition_variable> -*- C++ -*-
+
+// 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.
+
+/** @file condition_variable
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CONDITION_VARIABLE
+#define _GLIBCXX_CONDITION_VARIABLE 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <mutex> // unique_lock
+
+namespace std
+{
+ // XXX
+ class system_time;
+
+ /// condition_variable
+ class condition_variable
+ {
+ public:
+
+#if __GTHREAD_HAS_COND
+ typedef __gthread_cond_t native_handle_type;
+#else
+ typedef int native_handle_type;
+#endif
+
+ condition_variable();
+ ~condition_variable();
+
+ void
+ notify_one();
+
+ void
+ notify_all();
+
+ void
+ wait(unique_lock<mutex>& __lock);
+
+ template<typename _Predicate>
+ void
+ wait(unique_lock<mutex>& __lock, _Predicate __p)
+ {
+ while (!__p())
+ wait(__lock);
+ }
+
+ template<typename _Duration>
+ bool
+ timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime);
+
+ bool
+ timed_wait(unique_lock<mutex>& __lock, const system_time& __atime);
+
+ template<typename _Predicate>
+ bool
+ timed_wait(unique_lock<mutex>& __lock, const system_time& __atime,
+ _Predicate pred);
+
+ template<typename _Duration, typename _Predicate>
+ bool
+ timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime,
+ _Predicate pred);
+
+ native_handle_type
+ native_handle() { return _M_cond; }
+
+ private:
+ native_handle_type _M_cond;
+ condition_variable(const condition_variable&);
+ condition_variable& operator=(const condition_variable&);
+ };
+
+ /// condition_variable_any
+ // Like above, only mutex may not have try_lock.
+ class condition_variable_any
+ {
+ public:
+#if __GTHREAD_HAS_COND
+ typedef __gthread_cond_t native_handle_type;
+#else
+ typedef int native_handle_type;
+#endif
+
+ condition_variable_any();
+ ~condition_variable_any();
+
+ void
+ notify_one();
+
+ void
+ notify_all();
+
+ template<typename _Lock>
+ void
+ wait(_Lock& __lock);
+
+ template<typename _Lock, typename _Predicate>
+ void
+ wait(_Lock& __lock, _Predicate __p);
+
+ template<typename _Lock>
+ bool
+ timed_wait(_Lock& __lock, const system_time& __atime);
+
+ template<typename _Lock, typename _Duration>
+ bool
+ timed_wait(_Lock& __lock, const _Duration& __rtime);
+
+ template<typename _Lock, typename _Predicate>
+ bool
+ timed_wait(_Lock& __lock, const system_time& __atime, _Predicate __p);
+
+ template<typename _Lock, typename _Duration, typename _Predicate>
+ bool
+ timed_wait(_Lock& __lock, const _Duration& __rtime, _Predicate __p);
+
+ native_handle_type
+ 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&);
+ };
+
+}
+
+#endif
--- /dev/null
+// <mutex> -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 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.
+
+/** @file mutex
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_MUTEX
+#define _GLIBCXX_MUTEX 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <exception>
+#include <cstddef>
+#include <bits/functexcept.h>
+#include <bits/gthr.h>
+
+namespace std
+{
+ // XXX
+ class system_time;
+
+ /// mutex
+ class mutex
+ {
+ public:
+ typedef __gthread_mutex_t native_handle_type;
+
+ mutex()
+ {
+#if defined __GTHREAD_MUTEX_INIT
+ native_handle_type __tmp = __GTHREAD_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ int __e = __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+
+ // EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+ if ( __e)
+ __throw_system_error(__e);
+#endif
+ }
+
+ void
+ lock()
+ {
+ int __e = __gthread_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if ( __e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ int __e = __gthread_mutex_trylock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY
+ if ( __e)
+ __throw_system_error(__e);
+ else
+ return true;
+ }
+
+ void
+ unlock()
+ {
+ int __e = __gthread_mutex_unlock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EPERM
+ if ( __e)
+ __throw_system_error(__e);
+ }
+
+ native_handle_type
+ native_handle()
+ { return _M_mutex; }
+
+ private:
+ native_handle_type _M_mutex;
+ mutex(const mutex&);
+ mutex& operator=(const mutex&);
+ };
+
+
+ /// recursive_mutex
+ class recursive_mutex
+ {
+ public:
+ typedef __gthread_recursive_mutex_t native_handle_type;
+
+ recursive_mutex()
+ {
+#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
+ native_handle_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ int __e = __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+
+ // EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+ if ( __e)
+ __throw_system_error(__e);
+#endif
+ }
+
+
+ void
+ lock()
+ {
+ int __e = __gthread_recursive_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if ( __e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ int __e = __gthread_recursive_mutex_trylock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY
+ if ( __e)
+ __throw_system_error(__e);
+ else
+ return true;
+ }
+
+ void
+ unlock()
+ {
+ int __e = __gthread_recursive_mutex_unlock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY
+ if ( __e)
+ __throw_system_error(__e);
+ }
+
+ native_handle_type
+ native_handle() { return _M_mutex; }
+
+ private:
+ native_handle_type _M_mutex;
+
+ recursive_mutex(const recursive_mutex&);
+ recursive_mutex& operator=(const recursive_mutex&);
+ };
+
+
+ // class timed_mutex;
+ // class recursive_timed_mutex;
+
+ /// Do not acquire ownership of the mutex.
+ struct defer_lock_t { };
+
+ /// Try to acquire ownership of the mutex without blocking.
+ struct try_to_lock_t { };
+
+ /// Assume the calling thread has already obtained mutex ownership
+ /// and manage it.
+ struct adopt_lock_t { };
+
+ extern const defer_lock_t defer_lock;
+ extern const try_to_lock_t try_to_lock;
+ extern const adopt_lock_t adopt_lock;
+
+ /// Thrown to indicate errors with lock operations.
+ class lock_error : public exception
+ {
+ public:
+ virtual const char*
+ what() const throw();
+ };
+
+ /// @brief Scoped lock idiom.
+ // Acquire the mutex here with a constructor call, then release with
+ // the destructor call in accordance with RAII style.
+ template<typename _Mutex>
+ class lock_guard
+ {
+ public:
+ typedef _Mutex mutex_type;
+
+ explicit lock_guard(mutex_type& __m) : _M_device(__m)
+ { _M_device.lock(); }
+
+ lock_guard(mutex_type& __m, adopt_lock_t __a) : _M_device(__m)
+ { _M_device.lock(); }
+
+ ~lock_guard()
+ { _M_device.unlock(); }
+
+ private:
+ mutex_type& _M_device;
+ lock_guard(lock_guard const&);
+ lock_guard& operator=(lock_guard const&);
+ };
+
+ /// unique_lock
+ template<typename _Mutex>
+ class unique_lock
+ {
+ public:
+ typedef _Mutex mutex_type;
+
+ unique_lock() : _M_device(NULL), _M_owns(false) { }
+
+ explicit unique_lock(mutex_type& __m) : _M_device(&__m)
+ {
+ lock();
+ _M_owns = true;
+ }
+
+ unique_lock(mutex_type& __m, defer_lock_t)
+ : _M_device(&__m), _M_owns(false) { }
+
+ unique_lock(mutex_type& __m, try_to_lock_t)
+ : _M_device(&__m), _M_owns(_M_device->try_lock()) { }
+
+ unique_lock(mutex_type& __m, adopt_lock_t)
+ : _M_device(&__m), _M_owns(true)
+ {
+ // XXX calling thread owns mutex
+ }
+
+ unique_lock(mutex_type& __m, const system_time& abs_time);
+
+ template<typename _Duration>
+ unique_lock(mutex_type& __m, const _Duration& rel_time);
+
+ ~unique_lock()
+ {
+ if (_M_owns)
+ unlock();
+ }
+
+ unique_lock(unique_lock&&);
+
+ unique_lock& operator=(unique_lock&&);
+
+
+ void
+ lock()
+ {
+ if (_M_device && !_M_owns)
+ _M_device->lock();
+ else
+ throw lock_error();
+ }
+
+ bool
+ try_lock()
+ {
+ bool __ret = false;
+ if (_M_device && !_M_owns)
+ __ret = _M_device->try_lock();
+ else
+ throw lock_error();
+ return __ret;
+ }
+
+ void
+ unlock()
+ {
+ if (_M_device && _M_owns)
+ _M_device->unlock();
+ else
+ throw lock_error();
+ }
+
+
+ template<typename _Duration>
+ bool timed_lock(const _Duration& rel_time);
+
+ bool
+ timed_lock(const system_time& abs_time);
+
+ void
+ swap(unique_lock&& __u);
+
+ mutex_type*
+ release()
+ {
+ mutex_type* __ret = _M_device;
+ _M_device = NULL;
+ _M_owns = false;
+ return __ret;
+ }
+
+ bool
+ owns_lock() const { return _M_owns; }
+
+ operator bool () const { return owns_lock(); }
+
+ mutex_type*
+ mutex() const
+ { 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);
+
+ template<typename _Mutex>
+ void
+ swap(unique_lock<_Mutex>&& __x, unique_lock<_Mutex>& __y);
+
+ template<typename _Mutex>
+ void
+ swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>&& __y);
+
+ template<typename _L1, typename _L2, typename ..._L3>
+ int
+ try_lock(_L1&, _L2&, _L3&...);
+
+ template<typename _L1, typename _L2, typename ..._L3>
+ void
+ lock(_L1&, _L2&, _L3&...);
+
+ /// once_flag
+ struct once_flag
+ {
+ typedef __gthread_once_t __native_type;
+
+ once_flag() : _M_once(__GTHREAD_ONCE_INIT) { }
+
+ __native_type&
+ _M_get() { return _M_once; }
+
+ private:
+ __native_type _M_once;
+ once_flag(const once_flag&);
+ once_flag& operator=(const once_flag&);
+ };
+
+ template<typename _Callable, typename... _Args>
+ void
+ call_once(once_flag& __once, _Callable __f, _Args&&... __args)
+ {
+ int __e = __gthread_once(&(__once._M_get()), __f(__args...));
+ if ( __e)
+ __throw_system_error(__e);
+ }
+}
+
+
+#endif
valarray-inst.cc \
wlocale-inst.cc \
wstring-inst.cc \
+ mutex.cc \
+ condition_variable.cc \
${host_sources} \
${host_sources_extra}
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
# Use special rules for the C++0x sources so that the proper flags are passed.
+functexcept.lo: functexcept.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+functexcept.o: functexcept.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
system_error.lo: system_error.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
system_error.o: system_error.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
+mutex.lo: mutex.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+mutex.o: mutex.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+condition_variable.lo: condition_variable.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+condition_variable.o: condition_variable.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
hash_c++0x.lo: hash_c++0x.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
hash_c++0x.o: hash_c++0x.cc
iostream-inst.cc istream-inst.cc istream.cc locale-inst.cc \
misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \
- wstring-inst.cc atomicity.cc codecvt_members.cc \
- collate_members.cc ctype_members.cc messages_members.cc \
- monetary_members.cc numeric_members.cc time_members.cc \
- basic_file.cc c++locale.cc compatibility-ldbl.cc \
- parallel_list.cc parallel_settings.cc
+ wstring-inst.cc mutex.cc condition_variable.cc atomicity.cc \
+ codecvt_members.cc collate_members.cc ctype_members.cc \
+ messages_members.cc monetary_members.cc numeric_members.cc \
+ time_members.cc basic_file.cc c++locale.cc \
+ compatibility-ldbl.cc parallel_list.cc parallel_settings.cc
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
numeric_members.lo time_members.lo
istream-inst.lo istream.lo locale-inst.lo misc-inst.lo \
ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \
string-inst.lo valarray-inst.lo wlocale-inst.lo \
- wstring-inst.lo $(am__objects_1) $(am__objects_4)
+ wstring-inst.lo mutex.lo condition_variable.lo \
+ $(am__objects_1) $(am__objects_4)
am_libstdc___la_OBJECTS = $(am__objects_5)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
valarray-inst.cc \
wlocale-inst.cc \
wstring-inst.cc \
+ mutex.cc \
+ condition_variable.cc \
${host_sources} \
${host_sources_extra}
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
# Use special rules for the C++0x sources so that the proper flags are passed.
+functexcept.lo: functexcept.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+functexcept.o: functexcept.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
system_error.lo: system_error.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
system_error.o: system_error.cc
$(CXXCOMPILE) -std=gnu++0x -c $<
+mutex.lo: mutex.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+mutex.o: mutex.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
+condition_variable.lo: condition_variable.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+condition_variable.o: condition_variable.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
hash_c++0x.lo: hash_c++0x.cc
$(LTCXXCOMPILE) -std=gnu++0x -c $<
hash_c++0x.o: hash_c++0x.cc
--- /dev/null
+// mutex -*- C++ -*-
+
+// 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>
+
+namespace std
+{
+ condition_variable::condition_variable()
+ {
+#if __GTHREAD_HAS_COND
+# if defined __GTHREAD_COND_INIT
+ native_handle_type __tmp = __GTHREAD_COND_INIT;
+ _M_cond = __tmp;
+# else
+ int __e = __gthread_cond_init(&_M_cond, NULL);
+ 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);
+ // if __e == EBUSY then blocked
+#endif
+ }
+
+ void
+ condition_variable::notify_one()
+ {
+#if __GTHREAD_HAS_COND
+ int __e = pthread_cond_signal(&_M_cond);
+
+ // XXX not in spec
+ // EINVAL
+ if ( __e)
+ __throw_system_error(__e);
+#endif
+ }
+
+ void
+ condition_variable::notify_all()
+ {
+#if __GTHREAD_HAS_COND
+ int __e = pthread_cond_broadcast(&_M_cond);
+
+ // XXX not in spec
+ // EINVAL
+ if ( __e)
+ __throw_system_error(__e);
+#endif
+ }
+
+}
+
#include <cstdlib>
#include <exception>
#include <stdexcept>
+#include <system_error>
#include <new>
#include <typeinfo>
#include <ios>
__throw_underflow_error(const char* __s)
{ throw underflow_error(_(__s)); }
+ void
+ __throw_system_error(const char* __s)
+ { throw system_error(_(__s)); }
+
+ void
+ __throw_system_error(int __i)
+ { throw system_error(error_code(__i, system_category)); }
+
void
__throw_ios_failure(const char* __s)
{ throw ios_base::failure(_(__s)); }
__throw_underflow_error(const char*)
{ std::abort(); }
+ void
+ __throw_system_error(const char* __s)
+ { std::abort(); }
+
+ void
+ __throw_system_error(int __i)
+ { std::abort(); }
+
void
__throw_ios_failure(const char*)
{ std::abort(); }
--- /dev/null
+// mutex -*- C++ -*-
+
+// 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>
+
+namespace std
+{
+ const defer_lock_t defer_lock = defer_lock_t();
+ const try_to_lock_t try_to_lock = try_to_lock_t();
+ const adopt_lock_t adopt_lock = adopt_lock_t();
+
+ const char*
+ lock_error::what() const throw()
+ { return "std::lock_error"; }
+}
+
#include <algorithm>
#include <array>
#include <bitset>
+#include <condition_variable>
#include <complex>
#include <date_time>
#include <deque>
#include <locale>
#include <map>
#include <memory>
+#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
--- /dev/null
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// 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.
+
+#include <condition_variable> // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 }
+
+
+
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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.
+
+#include <condition_variable>
+
+void test01()
+{
+ typedef std::condition_variable c_t;
+ typedef std::condition_variable_any ca_t;
+}
--- /dev/null
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// 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.
+
+#include <mutex> // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 }
+
+
+
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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.
+
+#include <mutex>
+
+void test01()
+{
+ typedef std::mutex mutext_t;
+ typedef std::recursive_mutex rmutext_t;
+
+ typedef std::defer_lock_t dl_t;
+ typedef std::try_to_lock_t ttl_t;
+ typedef std::adopt_lock_t al_t;
+
+ using std::defer_lock;
+ using std::try_to_lock;
+ using std::adopt_lock;
+
+ typedef std::lock_error error_t;
+
+ typedef std::once_flag once_t;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-03-14 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.
+
+// NB: This file is for testing with NO OTHER INCLUDES.
+
+#include <mutex>
+
+namespace std
+{
+ template class lock_guard<mutex>;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-03-14 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.
+
+// NB: This file is for testing with NO OTHER INCLUDES.
+
+#include <mutex>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::lock_guard<std::mutex> test_type;
+ typedef test_type::mutex_type mutex_type;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::mutex mutex_type;
+
+ try
+ {
+ mutex_type m1;
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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::mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2;
+ m1 = m2;
+}
+// { dg-error "within this context" "" { target *-*-* } 39 }
+// { dg-error "is private" "" { target *-*-* } 113 }
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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::mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2(m1);
+}
+// { dg-error "within this context" "" { target *-*-* } 38 }
+// { dg-error "is private" "" { target *-*-* } 112 }
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::mutex mutex_type;
+
+ try
+ {
+ mutex_type m;
+ m.lock();
+
+ // Lock already locked mutex, should be ok.
+ // XXX
+ try
+ {
+ 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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::mutex mutex_type;
+
+ try
+ {
+ mutex_type m;
+ mutex_type::native_handle_type n = m.native_handle();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 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::mutex test_type;
+ typedef test_type::native_handle_type type;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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::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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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_mutex mutex_type;
+
+ try
+ {
+ mutex_type m1;
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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_mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2;
+ m1 = m2;
+}
+// { dg-error "within this context" "" { target *-*-* } 39 }
+// { dg-error "is private" "" { target *-*-* } 177 }
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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_mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2(m1);
+}
+// { dg-error "within this context" "" { target *-*-* } 38 }
+// { dg-error "is private" "" { target *-*-* } 176 }
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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_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;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// 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_mutex mutex_type;
+
+ try
+ {
+ mutex_type m;
+ mutex_type::native_handle_type n = m.native_handle();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 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_mutex test_type;
+ typedef test_type::native_handle_type type;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-03-14 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.
+
+// NB: This file is for testing with NO OTHER INCLUDES.
+
+#include <mutex>
+
+namespace std
+{
+ template class unique_lock<mutex>;
+}
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2008-03-14 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.
+
+// NB: This file is for testing with NO OTHER INCLUDES.
+
+#include <mutex>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::unique_lock<std::mutex> test_type;
+ typedef test_type::mutex_type mutex_type;
+}