aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
committerJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
commitb094d6c4bf572654a031ecc4afe675154c886dc5 (patch)
tree89394c56b05e13a5413ee60237d65b0214fd98e2 /gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex
parentdc34721ac3bf7e3c406fba8cfe9d139393345ec5 (diff)
downloadtoolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.gz
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.bz2
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.zip
commit gcc-4.4.3 which is used to build gcc-4.4.3 Android toolchain in master.
The source is based on fsf gcc-4.4.3 and contains local patches which are recorded in gcc-4.4.3/README.google. Change-Id: Id8c6d6927df274ae9749196a1cc24dbd9abc9887
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex')
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc49
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc36
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc35
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc51
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc63
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc51
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc33
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/standard_layout.cc31
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc32
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc52
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc63
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc52
12 files changed, 548 insertions, 0 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc
new file mode 100644
index 000000000..b743b9980
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc
@@ -0,0 +1,49 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
new file mode 100644
index 000000000..078cffcea
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <mutex>
+
+void test01()
+{
+ // assign
+ typedef std::mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2;
+ m1 = m2;
+}
+
+// { dg-error "used here" "" { target *-*-* } 32 }
+// { dg-error "deleted function" "" { target *-*-* } 83 }
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
new file mode 100644
index 000000000..e13a0f6cf
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <mutex>
+
+void test01()
+{
+ // assign
+ typedef std::mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2(m1);
+}
+
+// { dg-error "used here" "" { target *-*-* } 31 }
+// { dg-error "deleted function" "" { target *-*-* } 82 }
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc
new file mode 100644
index 000000000..ee0ddd8f2
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc
@@ -0,0 +1,51 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc
new file mode 100644
index 000000000..6c4a0a0d3
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/lock/1.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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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.
+ 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/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc
new file mode 100644
index 000000000..d1700e3d3
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc
@@ -0,0 +1,51 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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();
+ (void)n;
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc
new file mode 100644
index 000000000..44349acb6
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc
@@ -0,0 +1,33 @@
+// { 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) 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <mutex>
+#include <thread/all.h>
+
+int main()
+{
+ typedef std::mutex test_type;
+ __gnu_test::compare_type_to_native_type<test_type>();
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/standard_layout.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/standard_layout.cc
new file mode 100644
index 000000000..fae21013c
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/standard_layout.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <mutex>
+#include <testsuite_common_types.h>
+
+void test01()
+{
+ __gnu_test::standard_layout test;
+ test.operator()<std::mutex>();
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc
new file mode 100644
index 000000000..662831dad
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/requirements/typedefs.cc
@@ -0,0 +1,32 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <mutex>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::mutex test_type;
+ typedef test_type::native_handle_type type;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc
new file mode 100644
index 000000000..5a3589c20
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc
@@ -0,0 +1,52 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
new file mode 100644
index 000000000..ab5cf7c0e
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/try_lock/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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc
new file mode 100644
index 000000000..228f2bcdb
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc
@@ -0,0 +1,52 @@
+// { 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, 2009 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#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;
+}