aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/include/__thread/thread.h
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-04-05 01:46:13 -0400
committerGitHub <noreply@github.com>2025-04-05 01:46:13 -0400
commit0cd31fc7ff157551cfbba5da35cd79f118d2a2e3 (patch)
treea308488f5d85184c8ec402fb3f55f1cf2704443e /lib/libcxx/include/__thread/thread.h
parent8acedfd5baabab705946ad097746f9183ef62420 (diff)
parentcefe65c1b8abe65a22d4b68410db1be264fdeda0 (diff)
downloadzig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.tar.gz
zig-0cd31fc7ff157551cfbba5da35cd79f118d2a2e3.zip
Merge pull request #22780 from ziglang/llvm20
LLVM 20
Diffstat (limited to 'lib/libcxx/include/__thread/thread.h')
-rw-r--r--lib/libcxx/include/__thread/thread.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/libcxx/include/__thread/thread.h b/lib/libcxx/include/__thread/thread.h
index d2254a695f..c40ffd25b9 100644
--- a/lib/libcxx/include/__thread/thread.h
+++ b/lib/libcxx/include/__thread/thread.h
@@ -10,6 +10,7 @@
#ifndef _LIBCPP___THREAD_THREAD_H
#define _LIBCPP___THREAD_THREAD_H
+#include <__assert>
#include <__condition_variable/condition_variable.h>
#include <__config>
#include <__exception/terminate.h>
@@ -17,13 +18,17 @@
#include <__functional/unary_function.h>
#include <__memory/unique_ptr.h>
#include <__mutex/mutex.h>
-#include <__system_error/system_error.h>
+#include <__system_error/throw_system_error.h>
#include <__thread/id.h>
#include <__thread/support.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
#include <tuple>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+#if _LIBCPP_HAS_LOCALIZATION
# include <locale>
# include <sstream>
#endif
@@ -37,6 +42,8 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
+#if _LIBCPP_HAS_THREADS
+
template <class _Tp>
class __thread_specific_ptr;
class _LIBCPP_EXPORTED_FROM_ABI __thread_struct;
@@ -117,7 +124,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public __unary_function<__thread
}
};
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# if _LIBCPP_HAS_LOCALIZATION
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
@@ -142,7 +149,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
__sstr << __id.__id_;
return __os << __sstr.str();
}
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
+# endif // _LIBCPP_HAS_LOCALIZATION
class _LIBCPP_EXPORTED_FROM_ABI thread {
__libcpp_thread_t __t_;
@@ -155,13 +162,13 @@ public:
typedef __libcpp_thread_t native_handle_type;
_LIBCPP_HIDE_FROM_ABI thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
template <class _Fp, class... _Args, __enable_if_t<!is_same<__remove_cvref_t<_Fp>, thread>::value, int> = 0>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args);
-#else // _LIBCPP_CXX03_LANG
+# else // _LIBCPP_CXX03_LANG
template <class _Fp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f);
-#endif
+# endif
~thread();
_LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; }
@@ -185,7 +192,7 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
template <class _TSp, class _Fp, class... _Args, size_t... _Indices>
inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) {
@@ -215,7 +222,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) {
__throw_system_error(__ec, "thread constructor failed");
}
-#else // _LIBCPP_CXX03_LANG
+# else // _LIBCPP_CXX03_LANG
template <class _Fp>
struct __thread_invoke_pair {
@@ -247,10 +254,12 @@ thread::thread(_Fp __f) {
__throw_system_error(__ec, "thread constructor failed");
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x.swap(__y); }
+#endif // _LIBCPP_HAS_THREADS
+
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS