OSDN Git Service

2011-11-18 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / condition_variable.cc
index 4fb2f17..400fcf3 100644 (file)
@@ -1,6 +1,6 @@
 // condition_variable -*- C++ -*-
 
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010 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
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
 {
-  condition_variable::condition_variable() throw ()
-  {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 #ifdef __GTHREAD_COND_INIT
-    __native_type __tmp = __GTHREAD_COND_INIT;
-    _M_cond = __tmp;
+  condition_variable::condition_variable() noexcept = default;
+  condition_variable::~condition_variable() noexcept = default;
 #else
-    int __e = __gthread_cond_init(&_M_cond, NULL);
+  condition_variable::condition_variable() noexcept
+  {
+    int __e = __gthread_cond_init(&_M_cond, 0);
 
     if (__e)
       __throw_system_error(__e);
-#endif
   }
 
-  condition_variable::~condition_variable() throw ()
+  condition_variable::~condition_variable() noexcept
   {
     // XXX no thread blocked
     /* int __e = */ __gthread_cond_destroy(&_M_cond);
     // if __e == EBUSY then blocked
   }
+#endif
 
   void
   condition_variable::wait(unique_lock<mutex>& __lock)
@@ -58,7 +60,7 @@ namespace std
   }
 
   void
-  condition_variable::notify_one()
+  condition_variable::notify_one() noexcept
   {
     int __e = __gthread_cond_signal(&_M_cond);
 
@@ -69,7 +71,7 @@ namespace std
   }
 
   void
-  condition_variable::notify_all()
+  condition_variable::notify_all() noexcept
   {
     int __e = __gthread_cond_broadcast(&_M_cond);
 
@@ -79,23 +81,11 @@ namespace std
       __throw_system_error(__e);
   }
 
-  condition_variable_any::condition_variable_any() throw ()
-  {
-#ifdef __GTHREAD_COND_INIT
-    __native_type __tmp = __GTHREAD_COND_INIT;
-    _M_cond = __tmp;
-#else
-    int __e = __gthread_cond_init(&_M_cond, NULL);
+  condition_variable_any::condition_variable_any() noexcept = default;
 
-    if (__e)
-      __throw_system_error(__e);
-#endif
-  }
+  condition_variable_any::~condition_variable_any() noexcept = default;
 
-  condition_variable_any::~condition_variable_any() throw ()
-  {
-    __gthread_cond_destroy(&_M_cond);
-  }
-}
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
 
 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1