aboutsummaryrefslogtreecommitdiffstats
path: root/include/thread
diff options
context:
space:
mode:
Diffstat (limited to 'include/thread')
-rw-r--r--include/thread78
1 files changed, 5 insertions, 73 deletions
diff --git a/include/thread b/include/thread
index 3d8d2ac9ce50..02da703c3ccf 100644
--- a/include/thread
+++ b/include/thread
@@ -14,8 +14,6 @@
thread synopsis
-#define __STDCPP_THREADS__ __cplusplus
-
namespace std
{
@@ -107,8 +105,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-#define __STDCPP_THREADS__ __cplusplus
-
#ifdef _LIBCPP_HAS_NO_THREADS
#error <thread> is not supported on this single threaded system
#else // !_LIBCPP_HAS_NO_THREADS
@@ -200,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>
@@ -269,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
{