summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/util/thread/all.h
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2009-02-10 08:29:57 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2009-02-10 08:29:57 +0000
commitf7459b6c53c4633371442d020051707bfcfcbdf1 (patch)
tree19f878843cba38e4bd49fe8d61f7521c7fad4342 /libstdc++-v3/testsuite/util/thread/all.h
parent7314b35ac278e60dd6576ffbab0b80dd4de74a69 (diff)
downloadgcc-f7459b6c53c4633371442d020051707bfcfcbdf1.tar.gz
condition_variable (condition_variable): Remove _M_internal_mutex.
2009-02-09 Benjamin Kosnik <bkoz@redhat.com> * include/std/condition_variable (condition_variable): Remove _M_internal_mutex. Add private __native_type typedef. * src/condition_variable.cc (condition_variable::notify_one): Remove _M_internal_mutex use. Use typedef. (condition_variable::notify_all): Same. * include/std/mutex (mutex): Add private __native_type typedef. Use it. (recursive_mutex): Same. (timed_mutex): Same. (recursive_timed_mutex): Same. (once_flag): Make __native_type typedef private. * include/std/thread (this_thread): Add minimal markup. * testsuite/30_threads/condition_variable_any/cons/assign_neg.cc: Adjust line numbers. * testsuite/30_threads/condition_variable_any/cons/copy_neg.cc: Same. * testsuite/30_threads/mutex/cons/assign_neg.cc: Same. * testsuite/30_threads/mutex/cons/copy_neg.cc: Same. * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Same. * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Same. * testsuite/30_threads/thread/cons/assign_neg.cc: Same. * testsuite/30_threads/thread/cons/copy_neg.cc: Same. * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Same. * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Same. * testsuite/30_threads/condition_variable/cons/assign_neg.cc: Same. * testsuite/30_threads/condition_variable/cons/copy_neg.cc: Same. * testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc: Same. * testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc: Same. * testsuite/util/thread/all.h: Testsuite utilities for testing thread. * testsuite/30_threads/condition_variable_any/native_handle/ typesizes.cc: New. * testsuite/30_threads/mutex/native_handle/typesizes.cc: Same. * testsuite/30_threads/timed_mutex/native_handle/typesizes.cc: Same. * testsuite/30_threads/thread/native_handle/typesizes.cc: Same. * testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc: Same. * testsuite/30_threads/condition_variable/native_handle/ typesizes.cc: Same. * testsuite/30_threads/recursive_timed_mutex/native_handle/ typesizes.cc: Same. From-SVN: r144053
Diffstat (limited to 'libstdc++-v3/testsuite/util/thread/all.h')
-rw-r--r--libstdc++-v3/testsuite/util/thread/all.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/util/thread/all.h b/libstdc++-v3/testsuite/util/thread/all.h
new file mode 100644
index 00000000000..39dea5ff606
--- /dev/null
+++ b/libstdc++-v3/testsuite/util/thread/all.h
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+// Utilities for testing threads for the C++ library testsuite.
+//
+// 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 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.
+
+#ifndef _GLIBCXX_TESTSUITE_THREAD_H
+#define _GLIBCXX_TESTSUITE_THREAD_H
+
+#include <sstream>
+#include <stdexcept>
+#include <type_traits>
+
+// C++0x only.
+namespace __gnu_test
+{
+ // Assume _Tp::native_handle_type.
+ template<typename _Tp>
+ void
+ compare_type_to_native_type_sizes()
+ {
+ typedef _Tp test_type;
+ typedef typename test_type::native_handle_type native_handle_type;
+
+ int st = sizeof(test_type);
+
+ // Remove possible pointer type.
+ int snt = sizeof(typename std::remove_pointer<native_handle_type>::type);
+
+ if (st != snt)
+ {
+ std::ostringstream s;
+ s << std::endl;
+ s << "size of _Tp: " << st << std::endl;
+ s << "size of *(_Tp::native_handle_type): " << snt << std::endl;
+ throw std::runtime_error(s.str());
+ }
+ }
+} // namespace __gnu_test
+
+#endif // _GLIBCXX_TESTSUITE_THREAD_H
+