aboutsummaryrefslogtreecommitdiff
path: root/include/thread
diff options
context:
space:
mode:
Diffstat (limited to 'include/thread')
-rw-r--r--include/thread19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/thread b/include/thread
index 479e3c08f809..874ce3ec196c 100644
--- a/include/thread
+++ b/include/thread
@@ -261,7 +261,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(__thread_id __v) const
+ size_t operator()(__thread_id __v) const _NOEXCEPT
{
return hash<__libcpp_thread_id>()(__v.__id_);
}
@@ -290,7 +290,7 @@ public:
typedef __libcpp_thread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
- thread() _NOEXCEPT : __t_(0) {}
+ thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args,
class = typename enable_if
@@ -298,15 +298,18 @@ public:
!is_same<typename decay<_Fp>::type, thread>::value
>::type
>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
explicit thread(_Fp&& __f, _Args&&... __args);
#else // _LIBCPP_HAS_NO_VARIADICS
- template <class _Fp> explicit thread(_Fp __f);
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ explicit thread(_Fp __f);
#endif
~thread();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+ thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;}
_LIBCPP_INLINE_VISIBILITY
thread& operator=(thread&& __t) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -315,7 +318,7 @@ public:
void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
- bool joinable() const _NOEXCEPT {return __t_ != 0;}
+ bool joinable() const _NOEXCEPT {return !__libcpp_thread_isnull(&__t_);}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
@@ -409,10 +412,10 @@ inline
thread&
thread::operator=(thread&& __t) _NOEXCEPT
{
- if (__t_ != 0)
+ if (!__libcpp_thread_isnull(&__t_))
terminate();
__t_ = __t.__t_;
- __t.__t_ = 0;
+ __t.__t_ = _LIBCPP_NULL_THREAD;
return *this;
}
@@ -424,7 +427,7 @@ void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
namespace this_thread
{
-_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
+_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
template <class _Rep, class _Period>
void