condition_variable (condition_variable): Remove _M_internal_mutex.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 10 Feb 2009 08:29:57 +0000 (08:29 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 10 Feb 2009 08:29:57 +0000 (08:29 +0000)
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

28 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/condition_variable
libstdc++-v3/include/std/mutex
libstdc++-v3/include/std/thread
libstdc++-v3/src/condition_variable.cc
libstdc++-v3/src/thread.cc
libstdc++-v3/testsuite/30_threads/condition_variable/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/condition_variable/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/condition_variable_any/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/mutex/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/mutex/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/thread/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/thread/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc
libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc
libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc [new file with mode: 0644]
libstdc++-v3/testsuite/util/thread/all.h [new file with mode: 0644]

index 7841e75bd65e8890ede8bf502a90e5e5c5e4b879..b04ae7d8878a7489c92dd2221d3cc9d9f2c8be78 100644 (file)
@@ -1,3 +1,46 @@
+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.
+
 2009-02-09  Jack Howarth  <howarth@bromo.med.uc.edu>
 
        PR testsuite/33300
index 8325ff1aa952094f864c38d674af69b3c62b4db2..0c28b18fb6dcb3a75077e877a37a327f8f63b53a 100644 (file)
@@ -1,6 +1,6 @@
 // <condition_variable> -*- C++ -*-
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -50,10 +50,12 @@ namespace std
   /// condition_variable
   class condition_variable
   {
-    typedef chrono::system_clock __clock_t;
+    typedef chrono::system_clock       __clock_t;
+    typedef __gthread_cond_t           __native_type;
+    __native_type                      _M_cond;
 
   public:
-    typedef __gthread_cond_t* native_handle_type;
+    typedef __native_type*             native_handle_type;
 
     condition_variable();
     ~condition_variable();
@@ -104,8 +106,8 @@ namespace std
                 const chrono::time_point<_Clock, _Duration>& __atime,
                 _Predicate __p)
       {
-       while(!__p())
-         if(!wait_until(__lock, __atime))
+       while (!__p())
+         if (!wait_until(__lock, __atime))
            return __p();
        
        return true;
@@ -129,9 +131,6 @@ namespace std
     { return &_M_cond; }
 
   private:
-    __gthread_cond_t _M_cond;
-    mutex _M_internal_mutex;
-
     template<typename _Clock, typename _Duration>
       bool
       __wait_until_impl(unique_lock<mutex>& __lock,
@@ -160,8 +159,11 @@ namespace std
   // Like above, only mutex may not have try_lock.
   class condition_variable_any
   {
+    typedef __gthread_cond_t           __native_type;
+    __native_type                      _M_cond;
+
   public:
-    typedef __gthread_cond_t* native_handle_type;
+    typedef __native_type*             native_handle_type;
 
     condition_variable_any();
     ~condition_variable_any();
@@ -208,9 +210,6 @@ namespace std
     native_handle_type 
     native_handle()
     { return &_M_cond; }
-
-  private:
-    __gthread_cond_t _M_cond;
   };
 }
 
index 4964bb3bcbc16de57ccd7a78eadce31ade148ac8..22aff881335265fdfc44a073172d06f95cbf9fcc 100644 (file)
@@ -59,14 +59,17 @@ namespace std
   /// mutex
   class mutex
   {
+    typedef __gthread_mutex_t                  __native_type;
+    __native_type  _M_mutex;
+
   public:
-    typedef __gthread_mutex_t* native_handle_type;
+    typedef __native_type*                     native_handle_type;
 
     mutex()
     {
       // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
 #ifdef __GTHREAD_MUTEX_INIT
-      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+      __native_type __tmp = __GTHREAD_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
@@ -103,22 +106,22 @@ namespace std
     native_handle_type
     native_handle()
     { return &_M_mutex; }
-
-  private:
-    __gthread_mutex_t _M_mutex;
   };
 
   /// recursive_mutex
   class recursive_mutex
   {
+    typedef __gthread_recursive_mutex_t                __native_type;
+    __native_type  _M_mutex;
+
   public:
-    typedef __gthread_recursive_mutex_t* native_handle_type;
+    typedef __native_type*                     native_handle_type;
 
     recursive_mutex()
     {
       // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
 #ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
-      __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+      __native_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
@@ -155,21 +158,28 @@ namespace std
     native_handle_type
     native_handle()
     { return &_M_mutex; }
-
-  private:
-    __gthread_recursive_mutex_t  _M_mutex;
   };
 
   /// timed_mutex
   class timed_mutex
-  {  
+  {
+    typedef __gthread_mutex_t                  __native_type;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+    typedef chrono::monotonic_clock            __clock_t;
+#else
+    typedef chrono::high_resolution_clock      __clock_t;
+#endif
+
+    __native_type  _M_mutex;
+
   public:
-    typedef __gthread_mutex_t* native_handle_type;
+    typedef __native_type*                     native_handle_type;
 
     timed_mutex()
     {
 #ifdef __GTHREAD_MUTEX_INIT
-      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+      __native_type __tmp = __GTHREAD_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
@@ -204,19 +214,19 @@ namespace std
     template <class _Clock, class _Duration>
       bool
       try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
-      { 
+      {
        chrono::time_point<_Clock, chrono::seconds> __s =
-          chrono::time_point_cast<chrono::seconds>(__atime);
+         chrono::time_point_cast<chrono::seconds>(__atime);
 
        chrono::nanoseconds __ns =
-          chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+         chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
 
-        __gthread_time_t __ts = {
-          static_cast<std::time_t>(__s.time_since_epoch().count()),
-          static_cast<long>(__ns.count())
-        };
+       __gthread_time_t __ts = {
+         static_cast<std::time_t>(__s.time_since_epoch().count()),
+         static_cast<long>(__ns.count())
+       };
 
-       return !__gthread_mutex_timedlock(&_M_mutex, &__ts);    
+       return !__gthread_mutex_timedlock(&_M_mutex, &__ts);
       }
 
     void
@@ -229,50 +239,52 @@ namespace std
     native_handle_type
     native_handle()
     { return &_M_mutex; }
-    
-  private:
-    __gthread_mutex_t _M_mutex;
-    
-#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
-    typedef chrono::monotonic_clock __clock_t;
-#else
-    typedef chrono::high_resolution_clock __clock_t;
-#endif
 
+  private:
     template<typename _Rep, typename _Period>
       typename enable_if<
-        ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+       ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
       __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
       {
-        __clock_t::time_point __atime = __clock_t::now()
-          + chrono::duration_cast<__clock_t::duration>(__rtime);
+       __clock_t::time_point __atime = __clock_t::now()
+         + chrono::duration_cast<__clock_t::duration>(__rtime);
 
-        return try_lock_until(__atime);
+       return try_lock_until(__atime);
       }
 
     template <typename _Rep, typename _Period>
       typename enable_if<
-        !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+       !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
       __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
       {
-        __clock_t::time_point __atime = __clock_t::now()
+       __clock_t::time_point __atime = __clock_t::now()
          + ++chrono::duration_cast<__clock_t::duration>(__rtime);
 
-        return try_lock_until(__atime);
+       return try_lock_until(__atime);
       }
   };
 
   /// recursive_timed_mutex
   class recursive_timed_mutex
   {
+    typedef __gthread_recursive_mutex_t                __native_type;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+    typedef chrono::monotonic_clock            __clock_t;
+#else
+    typedef chrono::high_resolution_clock      __clock_t;
+#endif
+
+    __native_type  _M_mutex;
+
   public:
-    typedef __gthread_recursive_mutex_t* native_handle_type;
+    typedef __native_type*                     native_handle_type;
 
     recursive_timed_mutex()
     {
       // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
 #ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
-      __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+      __native_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
       _M_mutex = __tmp;
 #else
       __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
@@ -307,19 +319,19 @@ namespace std
     template <class _Clock, class _Duration>
       bool
       try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
-      { 
+      {
        chrono::time_point<_Clock, chrono::seconds>  __s =
-          chrono::time_point_cast<chrono::seconds>(__atime);
+         chrono::time_point_cast<chrono::seconds>(__atime);
 
        chrono::nanoseconds __ns =
-          chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+         chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
 
-        __gthread_time_t __ts = {
-          static_cast<std::time_t>(__s.time_since_epoch().count()),
-          static_cast<long>(__ns.count())
-        };
+       __gthread_time_t __ts = {
+         static_cast<std::time_t>(__s.time_since_epoch().count()),
+         static_cast<long>(__ns.count())
+       };
 
-        return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts);
+       return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts);
       }
 
     void
@@ -334,34 +346,26 @@ namespace std
     { return &_M_mutex; }
 
   private:
-    __gthread_recursive_mutex_t _M_mutex;
-
-#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
-    typedef chrono::monotonic_clock __clock_t;
-#else
-    typedef chrono::high_resolution_clock __clock_t;
-#endif
-
     template<typename _Rep, typename _Period>
       typename enable_if<
-        ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+       ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
       __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
       {
-        __clock_t::time_point __atime = __clock_t::now()
-          + chrono::duration_cast<__clock_t::duration>(__rtime);
+       __clock_t::time_point __atime = __clock_t::now()
+         + chrono::duration_cast<__clock_t::duration>(__rtime);
 
-        return try_lock_until(__atime);
+       return try_lock_until(__atime);
       }
 
     template <typename _Rep, typename _Period>
       typename enable_if<
-        !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+       !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
       __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
       {
-        __clock_t::time_point __atime = __clock_t::now()
+       __clock_t::time_point __atime = __clock_t::now()
          + ++chrono::duration_cast<__clock_t::duration>(__rtime);
 
-        return try_lock_until(__atime);
+       return try_lock_until(__atime);
       }
   };
 
@@ -418,7 +422,7 @@ namespace std
     {
     public:
       typedef _Mutex mutex_type;
-      
+
       unique_lock()
       : _M_device(0), _M_owns(false)
       { }
@@ -445,13 +449,13 @@ namespace std
       }
 
       template<typename _Clock, typename _Duration>
-       unique_lock(mutex_type& __m, 
+       unique_lock(mutex_type& __m,
                    const chrono::time_point<_Clock, _Duration>& __atime)
        : _M_device(&__m), _M_owns(_M_device->try_lock_until(__atime))
        { }
 
       template<typename _Rep, typename _Period>
-       unique_lock(mutex_type& __m, 
+       unique_lock(mutex_type& __m,
                    const chrono::duration<_Rep, _Period>& __rtime)
        : _M_device(&__m), _M_owns(_M_device->try_lock_for(__rtime))
        { }
@@ -474,14 +478,14 @@ namespace std
 
       unique_lock& operator=(unique_lock&& __u)
       {
-        if(_M_owns)
+       if(_M_owns)
          unlock();
-       
+
        unique_lock(std::move(__u)).swap(*this);
 
        __u._M_device = 0;
        __u._M_owns = false;
-       
+
        return *this;
       }
 
@@ -503,20 +507,20 @@ namespace std
       try_lock()
       {
        if (!_M_device)
-          __throw_system_error((int)errc::operation_not_permitted);
-        else if (_M_owns)
-          __throw_system_error((int)errc::resource_deadlock_would_occur);
-        else
+         __throw_system_error((int)errc::operation_not_permitted);
+       else if (_M_owns)
+         __throw_system_error((int)errc::resource_deadlock_would_occur);
+       else
          {
-           _M_owns = _M_device->try_lock();        
+           _M_owns = _M_device->try_lock();
            return _M_owns;
          }
       }
 
       template<typename _Clock, typename _Duration>
-        bool
-        try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
-        {
+       bool
+       try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+       {
          if (!_M_device)
            __throw_system_error((int)errc::operation_not_permitted);
          else if (_M_owns)
@@ -527,11 +531,11 @@ namespace std
              return _M_owns;
            }
        }
-      
+
       template<typename _Rep, typename _Period>
        bool
        try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
-        {
+       {
          if (!_M_device)
            __throw_system_error((int)errc::operation_not_permitted);
          else if (_M_owns)
@@ -546,15 +550,15 @@ namespace std
       void
       unlock()
       {
-        if (!_M_owns)
-          __throw_system_error((int)errc::operation_not_permitted);
-        else if (_M_device)
-          {
-            _M_device->unlock();
-            _M_owns = false;
-          }
+       if (!_M_owns)
+         __throw_system_error((int)errc::operation_not_permitted);
+       else if (_M_device)
+         {
+           _M_device->unlock();
+           _M_owns = false;
+         }
       }
-      
+
       void
       swap(unique_lock&& __u)
       {
@@ -606,30 +610,30 @@ namespace std
     struct __unlock_impl
     {
       template<typename... _Lock>
-        static void
-        __do_unlock(tuple<_Lock&...>& __locks)
-        {
+       static void
+       __do_unlock(tuple<_Lock&...>& __locks)
+       {
          std::get<_Idx>(__locks).unlock();
          __unlock_impl<_Idx - 1>::__do_unlock(__locks);
        }
     };
-  
+
   template<>
     struct __unlock_impl<-1>
     {
       template<typename... _Lock>
-        static void
-        __do_unlock(tuple<_Lock&...>&)
-        { }
+       static void
+       __do_unlock(tuple<_Lock&...>&)
+       { }
     };
 
   template<int _Idx, bool _Continue = true>
     struct __try_lock_impl
     {
       template<typename... _Lock>
-        static int
-        __do_try_lock(tuple<_Lock&...>& __locks)
-        {
+       static int
+       __do_try_lock(tuple<_Lock&...>& __locks)
+       {
          if(std::get<_Idx>(__locks).try_lock())
            {
              return __try_lock_impl<_Idx + 1,
@@ -642,14 +646,14 @@ namespace std
            }
        }
     };
-  
+
   template<int _Idx>
     struct __try_lock_impl<_Idx, false>
     {
       template<typename... _Lock>
-        static int
-        __do_try_lock(tuple<_Lock&...>& __locks)
-        {
+       static int
+       __do_try_lock(tuple<_Lock&...>& __locks)
+       {
          if(std::get<_Idx>(__locks).try_lock())
            return -1;
          else
@@ -659,12 +663,12 @@ namespace std
            }
        }
     };
-  
+
   /** @brief Generic try_lock.
    *  @param __l1 Meets Mutex requirements (try_lock() may throw).
    *  @param __l2 Meets Mutex requirements (try_lock() may throw).
    *  @param __l3 Meets Mutex requirements (try_lock() may throw).
-   *  @return Returns -1 if all try_lock() calls return true. Otherwise returns 
+   *  @return Returns -1 if all try_lock() calls return true. Otherwise returns
    *          a 0-based index corresponding to the argument that returned false.
    *  @post Either all arguments are locked, or none will be.
    *
@@ -685,23 +689,23 @@ namespace std
   /// once_flag
   struct once_flag
   {
+  private:
     typedef __gthread_once_t __native_type;
+    __native_type  _M_once;
 
+  public:
     once_flag()
     {
-      __gthread_once_t __tmp = __GTHREAD_ONCE_INIT;
+      __native_type __tmp = __GTHREAD_ONCE_INIT;
       _M_once = __tmp;
     }
-    
+
     once_flag(const once_flag&) = delete;
     once_flag& operator=(const once_flag&) = delete;
 
     template<typename _Callable, typename... _Args>
       friend void
       call_once(once_flag& __once, _Callable __f, _Args&&... __args);
-
-  private:
-    __native_type  _M_once;
   };
 
 #ifdef _GLIBCXX_HAVE_TLS
@@ -709,7 +713,7 @@ namespace std
   extern __thread void (*__once_call)();
 
   template<typename _Callable>
-    inline void 
+    inline void
     __once_call_impl()
     {
       (*(_Callable*)__once_callable)();
@@ -736,10 +740,10 @@ namespace std
       __functor_lock.lock();
       __once_functor = bind(__f, __args...);
 #endif
-     
+
       int __e = __gthread_once(&(__once._M_once), &__once_proxy);
 
-#ifndef _GLIBCXX_HAVE_TLS      
+#ifndef _GLIBCXX_HAVE_TLS
       if (__functor_lock)
        __functor_lock.unlock();
 #endif
index e0e093ce89c3cd884581efb1b4284250faeabf2d..b527d59caf7b45338a12bc403470ca0076c6928a 100644 (file)
@@ -57,7 +57,9 @@ namespace std
   class thread
   {
   public:
-    typedef __gthread_t                native_handle_type;
+    typedef __gthread_t                        native_handle_type;
+    struct _Impl_base;
+    typedef shared_ptr<_Impl_base>     __shared_base_type;
 
     /// thread::id
     class id
@@ -86,9 +88,6 @@ namespace std
        operator<<(basic_ostream<_CharT, _Traits>&& __out, thread::id __id);
     };
 
-    struct _Impl_base;
-    typedef shared_ptr<_Impl_base>     __shared_base_type;
-
     struct _Impl_base
     {
       id                       _M_id;
@@ -239,21 +238,25 @@ namespace std
   // 30.2.2 Namespace this_thread.
   namespace this_thread
   {
+    /// get_id
     inline thread::id
     get_id() { return thread::id(__gthread_self()); }
 
 #ifdef _GLIBCXX_USE_SCHED_YIELD
+    /// yield
     inline void
     yield()
     { __gthread_yield(); }
 #endif
 
 #ifdef _GLIBCXX_USE_NANOSLEEP
+    /// sleep_until
     template<typename _Clock, typename _Duration>
       inline void
       sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
       { sleep_for(__atime - _Clock::now()); }
 
+    /// sleep_for
     template<typename _Rep, typename _Period>
       inline void
       sleep_for(const chrono::duration<_Rep, _Period>& __rtime)
index cdad0512e7305393261eb3ab8ef72190e81b47d3..c916bf0c2052e08ba3af5da45cba7624a4039b28 100644 (file)
@@ -1,6 +1,6 @@
 // condition_variable -*- C++ -*-
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -36,7 +36,7 @@ namespace std
   condition_variable::condition_variable()
   {
 #ifdef __GTHREAD_COND_INIT
-    __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
+    __native_type __tmp = __GTHREAD_COND_INIT;
     _M_cond = __tmp;
 #else
     int __e = __gthread_cond_init(&_M_cond, NULL);
@@ -65,7 +65,6 @@ namespace std
   void 
   condition_variable::notify_one()
   { 
-    lock_guard<mutex> __lock(_M_internal_mutex);
     int __e = __gthread_cond_signal(&_M_cond);
 
     // XXX not in spec
@@ -77,7 +76,6 @@ namespace std
   void 
   condition_variable::notify_all()
   { 
-    lock_guard<mutex> __lock(_M_internal_mutex);
     int __e = __gthread_cond_broadcast(&_M_cond);
 
     // XXX not in spec
@@ -89,7 +87,7 @@ namespace std
   condition_variable_any::condition_variable_any()
   {
 #ifdef __GTHREAD_COND_INIT
-    __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
+    __native_type __tmp = __GTHREAD_COND_INIT;
     _M_cond = __tmp;
 #else
     int __e = __gthread_cond_init(&_M_cond, NULL);
index bc302834fe56bdf1427b158a21c004a5f84d80a6..2c3b5dc5134c7a9961bb746961384e51dac39c91 100644 (file)
@@ -45,7 +45,7 @@ namespace std
 
       __try
        {
-         __local->_M_run();
+         __t->_M_run();
        }
       __catch(...)
        {
@@ -90,7 +90,6 @@ namespace std
   void
   thread::_M_start_thread()
   {
-    // _M_data->_M_this_ptr = _M_data;
     _M_data->_M_this_ptr = _M_data;
     int __e = __gthread_create(&_M_data->_M_id._M_thread,
                               &execute_native_thread_routine, _M_data.get());
index 601bd82eedf39a732b99a5d1765f0d318ec2aa48..a29fb416c48b320fde3f9b2cb466883ef23903e6 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 }
-// { dg-error "deleted function" "" { target *-*-* } 62 }
+// { dg-error "deleted function" "" { target *-*-* } 64 }
index b617c8af4ce45c64ccf9dc7998ec32c0a78ebbbd..f27271623ec9e03f7526f239eb94cf1742c03179 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -40,4 +40,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 39 }
-// { dg-error "deleted function" "" { target *-*-* } 61 }
+// { dg-error "deleted function" "" { target *-*-* } 63 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..2dbaccc
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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 <thread/all.h>
+#include <condition_variable>
+
+int main()
+{
+  typedef std::condition_variable test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index 7399ed6f961dddcd322d152fae7619051b78498d..2bfdb798ebbb4e5ccd83064c47cca52b4be84d14 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 }
-// { dg-error "deleted function" "" { target *-*-* } 170 }
+// { dg-error "deleted function" "" { target *-*-* } 172 }
index 86c81a2b9144c38bb8959f544674096ccd86706f..3045257dcb19862d067b1167598d31e2ac082dc5 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -40,4 +40,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 39 }
-// { dg-error "deleted function" "" { target *-*-* } 169 }
+// { dg-error "deleted function" "" { target *-*-* } 171 }
diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..9d38896
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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 <thread/all.h>
+#include <condition_variable>
+
+int main()
+{
+  typedef std::condition_variable_any test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index ba7a53f2f165851e797f25e25921c91acbe9f252..e58973b6371d52809b575751e43575625fc77f3f 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -42,4 +42,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 41 }
-// { dg-error "deleted function" "" { target *-*-* } 77 }
+// { dg-error "deleted function" "" { target *-*-* } 80 }
index b1c97fe6b263e4f3615a08b8c79fe09c2241d915..e7b0bb642b6e06a13a96f8b8b264e2b2494365b4 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 }
-// { dg-error "deleted function" "" { target *-*-* } 76 }
+// { dg-error "deleted function" "" { target *-*-* } 79 }
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..b293008
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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 <thread/all.h>
+#include <mutex>
+
+int main()
+{
+  typedef std::mutex test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index b1b6c15b481549a6a286c57b404560f7a349dee8..a333a1478a6054223e01d34209df64a9cd16f723 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -42,4 +42,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 41 } 
-// { dg-error "deleted function" "" { target *-*-* } 129 }
+// { dg-error "deleted function" "" { target *-*-* } 132 }
index 2fa153be98172dfc1b52f0e13e68b94885e0f036..13a46dbcc8a3f6f761d02fa81cb2cf466886ff0a 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 } 
-// { dg-error "deleted function" "" { target *-*-* } 128 }
+// { dg-error "deleted function" "" { target *-*-* } 131 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..6d58c1e
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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 <thread/all.h>
+#include <mutex>
+
+int main()
+{
+  typedef std::recursive_mutex test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index 4d93beef812f891bfb66ed85d47daa39b47e0980..fca55a0751a2dc5dfb161b056c82c9713d1c0e22 100644 (file)
@@ -42,4 +42,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 41 } 
-// { dg-error "deleted function" "" { target *-*-* } 283 }
+// { dg-error "deleted function" "" { target *-*-* } 295 }
index e1b63c28a5aa9ee9a4cc8e71a17c66ace03bdcc3..c4c254a65792d06ce78bbe837c4bfc2323735dfa 100644 (file)
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 } 
-// { dg-error "deleted function" "" { target *-*-* } 282 }
+// { dg-error "deleted function" "" { target *-*-* } 294 }
diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..b51bdf2
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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>
+#include <thread/all.h>
+
+int main()
+{
+  typedef std::recursive_timed_mutex test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index 1428661b4e9a83f5a70a970702902e552f091678..527c29ce6393a676ba5a15e951e73c475a3bc26a 100644 (file)
@@ -33,4 +33,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 145 }
+// { dg-error "deleted function" "" { target *-*-* } 144 }
index 090db1546398b59a164b94287bd32d5dca6a4bc4..15ec77ea429d5629269ba9f5fdca1233095bf12a 100644 (file)
@@ -28,9 +28,9 @@ void test01()
   // copy
   typedef std::thread test_type;
   test_type t1;
-  test_type t2(t1);
+  test_type t2(t1); // XXX this is failing for the wrong reason
 }
 
 // { dg-error "here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 124 }
+// { dg-error "deleted function" "" { target *-*-* } 123 }
 // { dg-excess-errors "In file included from" }
diff --git a/libstdc++-v3/testsuite/30_threads/thread/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/thread/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..b1103d9
--- /dev/null
@@ -0,0 +1,35 @@
+// { 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 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 <thread/all.h>
+#include <thread>
+
+int main()
+{
+  typedef std::thread test_type;
+  // XXX disable at the moment
+  //__gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
index 715a5793a258176d70f9e081aab586f8556d4b79..058cfd2837b6c9eede8304ac96191a346ec3aaab 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -42,4 +42,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 41 } 
-// { dg-error "deleted function" "" { target *-*-* } 180 }
+// { dg-error "deleted function" "" { target *-*-* } 190 }
index 3c22c1eba95c318c5b2240c04c334f93f1ae4614..d49fda728b813cc0751bf5bd4da448de44cf06b9 100644 (file)
@@ -3,7 +3,7 @@
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// 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
@@ -41,4 +41,4 @@ void test01()
 }
 
 // { dg-error "used here" "" { target *-*-* } 40 } 
-// { dg-error "deleted function" "" { target *-*-* } 179 }
+// { dg-error "deleted function" "" { target *-*-* } 189 }
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc
new file mode 100644 (file)
index 0000000..7a59d7d
--- /dev/null
@@ -0,0 +1,34 @@
+// { 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 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 <thread/all.h>
+#include <mutex>
+
+int main()
+{
+  typedef std::timed_mutex test_type;
+  __gnu_test::compare_type_to_native_type_sizes<test_type>();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/thread/all.h b/libstdc++-v3/testsuite/util/thread/all.h
new file mode 100644 (file)
index 0000000..39dea5f
--- /dev/null
@@ -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
+