12#include "../utility/utility.hpp"
13#include "../macros.hpp"
21#include <unordered_map>
25hi_export_module(hikogui.concurrency.thread : intf);
27hi_export
namespace hi {
inline namespace v1 {
31inline unfair_mutex thread_names_mutex = {};
64 auto const lock = std::scoped_lock(detail::thread_names_mutex);
65 auto const it = detail::thread_names.find(
id);
66 if (it != detail::thread_names.
end()) {
69 return std::format(
"{}",
id);
124 hi_assert_bounds(cpu, available_cpus);
128 if (available_cpus[cpu]) {
131 selected_cpu = narrow_cast<ssize_t>(cpu);
139 if (++cpu >= available_cpus.size()) {
142 }
while (!available_cpus[cpu]);
143 }
while (selected_cpu < 0);
145 return narrow_cast<std::size_t>(selected_cpu);
Definition of the unfair_mutex.
std::vector< bool > process_affinity_mask()
Get the current process CPU affinity mask.
std::string get_thread_name(thread_id id) noexcept
Get the thread name of a thread id.
Definition thread_intf.hpp:62
void set_thread_name(std::string_view name) noexcept
Set the name of the current thread.
std::vector< bool > set_thread_affinity_mask(std::vector< bool > const &mask)
Set the current thread CPU affinity mask.
std::size_t current_cpu_id() noexcept
Get the current CPU id.
std::size_t advance_thread_affinity(std::size_t &cpu) noexcept
Advance thread affinity to the next CPU.
Definition thread_intf.hpp:121
std::vector< bool > set_thread_affinity(std::size_t cpu_id)
Set the current thread CPU affinity to a single CPU.
Definition thread_intf.hpp:103
thread_id current_thread_id() noexcept
Get the current thread id.
@ end
Start from the end of the file.
The HikoGUI namespace.
Definition array_generic.hpp:20
cpu_id_result cpu_id(uint32_t leaf_id, uint32_t index=0) noexcept
A generic x86 cpu-id instruction.
Definition cpu_id_x86.hpp:347
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Exception thrown during an operating system call.
Definition exception_intf.hpp:184