summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/thread
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/include/thread')
-rw-r--r--contrib/libc++/include/thread62
1 files changed, 33 insertions, 29 deletions
diff --git a/contrib/libc++/include/thread b/contrib/libc++/include/thread
index 479e3c0..1b8dca3 100644
--- a/contrib/libc++/include/thread
+++ b/contrib/libc++/include/thread
@@ -95,7 +95,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
#include <tuple>
#endif
#include <__threading_support>
@@ -105,6 +105,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#define __STDCPP_THREADS__ __cplusplus
#ifdef _LIBCPP_HAS_NO_THREADS
@@ -261,7 +264,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,32 +293,35 @@ public:
typedef __libcpp_thread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
- thread() _NOEXCEPT : __t_(0) {}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
+#ifndef _LIBCPP_CXX03_LANG
template <class _Fp, class ..._Args,
class = typename enable_if
<
!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);
+#else // _LIBCPP_CXX03_LANG
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ explicit thread(_Fp __f);
#endif
~thread();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_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
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
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
@@ -326,7 +332,7 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
@@ -366,7 +372,18 @@ thread::thread(_Fp&& __f, _Args&&... __args)
__throw_system_error(__ec, "thread constructor failed");
}
-#else // _LIBCPP_HAS_NO_VARIADICS
+inline
+thread&
+thread::operator=(thread&& __t) _NOEXCEPT
+{
+ if (!__libcpp_thread_isnull(&__t_))
+ terminate();
+ __t_ = __t.__t_;
+ __t.__t_ = _LIBCPP_NULL_THREAD;
+ return *this;
+}
+
+#else // _LIBCPP_CXX03_LANG
template <class _Fp>
struct __thread_invoke_pair {
@@ -401,22 +418,7 @@ thread::thread(_Fp __f)
__throw_system_error(__ec, "thread constructor failed");
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-inline
-thread&
-thread::operator=(thread&& __t) _NOEXCEPT
-{
- if (__t_ != 0)
- terminate();
- __t_ = __t.__t_;
- __t.__t_ = 0;
- return *this;
-}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
@@ -424,7 +426,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
@@ -477,4 +479,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_THREAD
OpenPOWER on IntegriCloud