noexcept applied to <thread>.

llvm-svn: 160606
This commit is contained in:
Howard Hinnant 2012-07-21 16:50:47 +00:00
parent 45c663db4e
commit 36101a5b0a
2 changed files with 38 additions and 38 deletions

View File

@ -26,41 +26,41 @@ public:
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 @@ operator<<(basic_ostream<charT, traits>& out, thread::id id);
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 @@ class __thread_id;
namespace this_thread
{
__thread_id get_id();
__thread_id get_id() _NOEXCEPT;
} // this_thread
@ -195,25 +195,25 @@ class _LIBCPP_VISIBLE __thread_id
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 @@ namespace this_thread
inline _LIBCPP_INLINE_VISIBILITY
__thread_id
get_id()
get_id() _NOEXCEPT
{
return pthread_self();
}
@ -266,7 +266,7 @@ public:
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 @@ public:
#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 @@ thread::thread(_Fp __f)
inline _LIBCPP_INLINE_VISIBILITY
thread&
thread::operator=(thread&& __t)
thread::operator=(thread&& __t) _NOEXCEPT
{
if (__t_ != 0)
terminate();
@ -398,7 +398,7 @@ thread::operator=(thread&& __t)
#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 @@ sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
}
inline _LIBCPP_INLINE_VISIBILITY
void yield() {sched_yield();}
void yield() _NOEXCEPT {sched_yield();}
} // this_thread

View File

@ -52,7 +52,7 @@ thread::detach()
}
unsigned
thread::hardware_concurrency()
thread::hardware_concurrency() _NOEXCEPT
{
#if defined(CTL_HW) && defined(HW_NCPU)
unsigned n;