diff options
| author | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-16 12:19:54 +0000 |
|---|---|---|
| committer | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-16 12:19:54 +0000 |
| commit | af762e91b2fe8b7aea7c5b0b7f2d831f8332860b (patch) | |
| tree | 069c08dc6f736a70120ac073e2d03f4aed94165d /libcxx/include/thread | |
| parent | 238169db60fe37a801a9bdb9174c2a0085286036 (diff) | |
| download | bcm5719-llvm-af762e91b2fe8b7aea7c5b0b7f2d831f8332860b.tar.gz bcm5719-llvm-af762e91b2fe8b7aea7c5b0b7f2d831f8332860b.zip | |
[libcxx] Don't assume __libcpp_thread_t is an integral type
We have already refactored the underlying platform thread type into
__libcpp_thread_t, but there are few places in the source where we
still assume it is an integral type.
This patch refactores those points back into the threading API.
Differential revision: https://reviews.llvm.org/D28608
Reviewers: EricWF
llvm-svn: 292107
Diffstat (limited to 'libcxx/include/thread')
| -rw-r--r-- | libcxx/include/thread | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libcxx/include/thread b/libcxx/include/thread index 479e3c08f80..602445644fc 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -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 @@ -306,7 +306,7 @@ public: #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 +315,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 +409,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; } |

