[cfe-commits] [libcxx] r160606 - in /libcxx/trunk: include/thread src/thread.cpp

Howard Hinnant hhinnant at apple.com
Sat Jul 21 09:50:47 PDT 2012


Author: hhinnant
Date: Sat Jul 21 11:50:47 2012
New Revision: 160606

URL: http://llvm.org/viewvc/llvm-project?rev=160606&view=rev
Log:
noexcept applied to <thread>.

Modified:
    libcxx/trunk/include/thread
    libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/include/thread
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=160606&r1=160605&r2=160606&view=diff
==============================================================================
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Sat Jul 21 11:50:47 2012
@@ -26,41 +26,41 @@
     class id;
     typedef pthread_t native_handle_type;
 
-    thread();
+    thread() noexcept;
     template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
     ~thread();
 
     thread(const thread&) = delete;
-    thread(thread&& t);
+    thread(thread&& t) noexcept;
 
     thread& operator=(const thread&) = delete;
-    thread& operator=(thread&& t);
+    thread& operator=(thread&& t) noexcept;
 
-    void swap(thread& t);
+    void swap(thread& t) noexcept;
 
-    bool joinable() const;
+    bool joinable() const noexcept;
     void join();
     void detach();
-    id get_id() const;
+    id get_id() const noexcept;
     native_handle_type native_handle();
 
-    static unsigned hardware_concurrency();
+    static unsigned hardware_concurrency() noexcept;
 };
 
-void swap(thread& x, thread& y);
+void swap(thread& x, thread& y) noexcept;
 
 class thread::id
 {
 public:
-    id();
+    id() noexcept;
 };
 
-bool operator==(thread::id x, thread::id y);
-bool operator!=(thread::id x, thread::id y);
-bool operator< (thread::id x, thread::id y);
-bool operator<=(thread::id x, thread::id y);
-bool operator> (thread::id x, thread::id y);
-bool operator>=(thread::id x, thread::id y);
+bool operator==(thread::id x, thread::id y) noexcept;
+bool operator!=(thread::id x, thread::id y) noexcept;
+bool operator< (thread::id x, thread::id y) noexcept;
+bool operator<=(thread::id x, thread::id y) noexcept;
+bool operator> (thread::id x, thread::id y) noexcept;
+bool operator>=(thread::id x, thread::id y) noexcept;
 
 template<class charT, class traits>
 basic_ostream<charT, traits>&
@@ -69,9 +69,9 @@
 namespace this_thread
 {
 
-thread::id get_id();
+thread::id get_id() noexcept;
 
-void yield();
+void yield() noexcept;
 
 template <class Clock, class Duration>
 void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
@@ -179,7 +179,7 @@
 namespace this_thread
 {
 
-__thread_id get_id();
+__thread_id get_id() _NOEXCEPT;
 
 }  // this_thread
 
@@ -195,25 +195,25 @@
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-    __thread_id() : __id_(0) {}
+    __thread_id() _NOEXCEPT : __id_(0) {}
 
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator==(__thread_id __x, __thread_id __y)
+        bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
         {return __x.__id_ == __y.__id_;}
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator!=(__thread_id __x, __thread_id __y)
+        bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
         {return !(__x == __y);}
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator< (__thread_id __x, __thread_id __y)
+        bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
         {return __x.__id_ < __y.__id_;}
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator<=(__thread_id __x, __thread_id __y)
+        bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
         {return !(__y < __x);}
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator> (__thread_id __x, __thread_id __y)
+        bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
         {return   __y < __x ;}
     friend _LIBCPP_INLINE_VISIBILITY
-        bool operator>=(__thread_id __x, __thread_id __y)
+        bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
         {return !(__x < __y);}
 
     template<class _CharT, class _Traits>
@@ -248,7 +248,7 @@
 
 inline _LIBCPP_INLINE_VISIBILITY
 __thread_id
-get_id()
+get_id() _NOEXCEPT
 {
     return pthread_self();
 }
@@ -266,7 +266,7 @@
     typedef pthread_t native_handle_type;
 
     _LIBCPP_INLINE_VISIBILITY
-    thread() : __t_(0) {}
+    thread() _NOEXCEPT : __t_(0) {}
 #ifndef _LIBCPP_HAS_NO_VARIADICS
     template <class _Fp, class ..._Args,
               class = typename enable_if
@@ -282,23 +282,23 @@
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
-    thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
-    thread& operator=(thread&& __t);
+    thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+    thread& operator=(thread&& __t) _NOEXCEPT;
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
     _LIBCPP_INLINE_VISIBILITY
-    void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);}
+    void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
 
     _LIBCPP_INLINE_VISIBILITY
-    bool joinable() const {return __t_ != 0;}
+    bool joinable() const _NOEXCEPT {return __t_ != 0;}
     void join();
     void detach();
     _LIBCPP_INLINE_VISIBILITY
-    id get_id() const {return __t_;}
+    id get_id() const _NOEXCEPT {return __t_;}
     _LIBCPP_INLINE_VISIBILITY
-    native_handle_type native_handle() {return __t_;}
+    native_handle_type native_handle() _NOEXCEPT {return __t_;}
 
-    static unsigned hardware_concurrency();
+    static unsigned hardware_concurrency() _NOEXCEPT;
 };
 
 class __assoc_sub_state;
@@ -386,7 +386,7 @@
 
 inline _LIBCPP_INLINE_VISIBILITY
 thread&
-thread::operator=(thread&& __t)
+thread::operator=(thread&& __t) _NOEXCEPT
 {
     if (__t_ != 0)
         terminate();
@@ -398,7 +398,7 @@
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
 inline _LIBCPP_INLINE_VISIBILITY
-void swap(thread& __x, thread& __y) {__x.swap(__y);}
+void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
 
 namespace this_thread
 {
@@ -438,7 +438,7 @@
 }
 
 inline _LIBCPP_INLINE_VISIBILITY
-void yield() {sched_yield();}
+void yield() _NOEXCEPT {sched_yield();}
 
 }  // this_thread
 

Modified: libcxx/trunk/src/thread.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=160606&r1=160605&r2=160606&view=diff
==============================================================================
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Sat Jul 21 11:50:47 2012
@@ -52,7 +52,7 @@
 }
 
 unsigned
-thread::hardware_concurrency()
+thread::hardware_concurrency() _NOEXCEPT
 {
 #if defined(CTL_HW) && defined(HW_NCPU)
     unsigned n;





More information about the cfe-commits mailing list