9#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
19namespace hi::inline v1 {
27void set_thread_name(std::string_view name);
29#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
31#elif HI_OPERATING_SYSTEM == HI_OS_LINUX || HI_OPERATING_SYSTEM == HI_OS_MACOS
32constexpr std::size_t maximum_num_cpus = CPU_SETSIZE;
35#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
36using thread_id = uint32_t;
38using thread_id = uint64_t;
41inline thread_local thread_id current_thread_id_dummy = 0;
47[[nodiscard]]
inline thread_id current_thread_id() noexcept
49#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
51 constexpr uint64_t NT_TIB_CurrentThreadID = 0x48;
52 return __readgsdword(NT_TIB_CurrentThreadID);
55 return reinterpret_cast<uint64_t
>(¤t_thread_id_dummy);
75std::vector<
bool> set_thread_affinity_mask(
std::vector<
bool> const &mask);
86std::vector<
bool> set_thread_affinity(
std::
size_t cpu_id);
97std::
size_t advance_thread_affinity(
std::
size_t &cpu) noexcept;
103[[nodiscard]]
std::
size_t current_cpu_id() noexcept;
This file includes required definitions.
Functions and macros for handling architectural difference between compilers, CPUs and operating syst...