summaryrefslogtreecommitdiffstats
path: root/libcxx/include/thread
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-08-14 16:21:27 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-08-14 16:21:27 +0000
commit2b1d42541f20ce919c7841328934f64366e39d7c (patch)
tree34344f7fe94faf4de6f5cb6574be9328b5ee3a65 /libcxx/include/thread
parent2be59170d433be05204992838a1aadbc79d5e0d1 (diff)
downloadbcm5719-llvm-2b1d42541f20ce919c7841328934f64366e39d7c.tar.gz
bcm5719-llvm-2b1d42541f20ce919c7841328934f64366e39d7c.zip
Rework recursive_timed_mutex so that it uses __thread_id instead of using the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895
llvm-svn: 368867
Diffstat (limited to 'libcxx/include/thread')
-rw-r--r--libcxx/include/thread74
1 files changed, 5 insertions, 69 deletions
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 4277bc90b36..02da703c3cc 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -196,64 +196,6 @@ __thread_specific_ptr<_Tp>::set_pointer(pointer __p)
__libcpp_tls_set(__key_, __p);
}
-class _LIBCPP_TYPE_VIS thread;
-class _LIBCPP_TYPE_VIS __thread_id;
-
-namespace this_thread
-{
-
-_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
-
-} // this_thread
-
-template<> struct hash<__thread_id>;
-
-class _LIBCPP_TEMPLATE_VIS __thread_id
-{
- // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
- // NULL is the no-thread value on Darwin. Someone needs to check
- // on other platforms. We assume 0 works everywhere for now.
- __libcpp_thread_id __id_;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- __thread_id() _NOEXCEPT : __id_(0) {}
-
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
- {return __libcpp_thread_id_equal(__x.__id_, __y.__id_);}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
- {return !(__x == __y);}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
- {return __libcpp_thread_id_less(__x.__id_, __y.__id_);}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
- {return !(__y < __x);}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
- {return __y < __x ;}
- friend _LIBCPP_INLINE_VISIBILITY
- bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
- {return !(__x < __y);}
-
- template<class _CharT, class _Traits>
- friend
- _LIBCPP_INLINE_VISIBILITY
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
- {return __os << __id.__id_;}
-
-private:
- _LIBCPP_INLINE_VISIBILITY
- __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
-
- friend __thread_id this_thread::get_id() _NOEXCEPT;
- friend class _LIBCPP_TYPE_VIS thread;
- friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>;
-};
-
template<>
struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
: public unary_function<__thread_id, size_t>
@@ -265,17 +207,11 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
}
};
-namespace this_thread
-{
-
-inline _LIBCPP_INLINE_VISIBILITY
-__thread_id
-get_id() _NOEXCEPT
-{
- return __libcpp_thread_get_current_id();
-}
-
-} // this_thread
+template<class _CharT, class _Traits>
+_LIBCPP_INLINE_VISIBILITY
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
+{return __os << __id.__id_;}
class _LIBCPP_TYPE_VIS thread
{
OpenPOWER on IntegriCloud