noexcept applied to <thread>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160606 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/thread b/include/thread
index 23b1915..b6b7000 100644
--- a/include/thread
+++ b/include/thread
@@ -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