|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
线程管理和相关操作 更多...
类 | |
| class | lazy_thread |
| 延迟启动线程类 更多... | |
| class | scoped_thread |
| 作用域线程类 更多... | |
| class | thread |
| 线程类 更多... | |
| class | thread_tracker |
| 线程跟踪器类 更多... | |
函数 | |
| NEFORCE_ALWAYS_INLINE_INLINE int64_t | current_cpu () noexcept |
| 获取当前CPU核心编号 | |
| NEFORCE_ALWAYS_INLINE_INLINE void | yield () noexcept |
| 让出当前线程的时间片 | |
| NEFORCE_ALWAYS_INLINE_INLINE void | relax () noexcept |
| 线程放松 | |
| NEFORCE_ALWAYS_INLINE_INLINE void | relax (const int count) noexcept |
| 根据计数进行线程放松 | |
| NEFORCE_ALWAYS_INLINE_INLINE void | sleep_for_ms (uint32_t milliseconds) noexcept |
| 睡眠指定毫秒数 | |
| void NEFORCE_API | sleep_for_ms (uint32_t ms, bool busy_wait) noexcept |
| 精确睡眠指定毫秒数 | |
| void NEFORCE_API | sleep_for_us (uint64_t us) noexcept |
| 精确睡眠指定微秒数 | |
| void NEFORCE_API | sleep_for_ns (uint64_t ns) noexcept |
| 精确睡眠指定纳秒数 | |
| bool NEFORCE_API | affinity (size_t cpu_mask) noexcept |
| 设置线程的CPU亲和性 | |
| bool NEFORCE_API | priority (int priority) noexcept |
| 设置线程优先级 | |
| NEFORCE_ALWAYS_INLINE_INLINE thread::id | id () noexcept |
| 获取当前线程标识符 | |
| NEFORCE_ALWAYS_INLINE_INLINE thread::native_handle_type | handle () noexcept |
| 获取当前线程句柄 | |
| NEFORCE_ALWAYS_INLINE_INLINE bool | name (char *buffer, size_t size) |
| 获取当前线程名称 | |
| NEFORCE_ALWAYS_INLINE_INLINE bool | set_name (const char *name) |
| 设置当前线程名称 | |
| NEFORCE_ALWAYS_INLINE_INLINE bool | is_single_threaded () noexcept |
| 检查当前是否处于单线程模式 | |
| NEFORCE_ALWAYS_INLINE_INLINE int | thread_count () noexcept |
| 获取当前活动线程数量 | |
| template<typename Clock, typename Dur> | |
| void | sleep_until (const time_point< Clock, Dur > &time) |
| 使当前线程睡眠直到指定时间点 | |
| template<typename Rep, typename Period> | |
| void | sleep_for (const duration< Rep, Period > time) |
| 使当前线程睡眠指定时间 | |
线程管理和相关操作
|
noexcept |
设置线程的CPU亲和性
| cpu_mask | CPU掩码,每个位表示一个CPU核心 |
设置当前线程可以在哪些CPU核心上运行。
|
noexcept |
|
noexcept |
获取当前线程句柄
在文件 thread.hpp 第 461 行定义.
被这些函数引用 virtual_thread_awaiter::await_suspend(), file_async::file_async(), file_info::file_info(), file_locker::file_locker(), thread::name(), virtual_thread_scheduler::schedule() , 以及 thread::set_name().
|
noexcept |
获取当前线程标识符
在文件 thread.hpp 第 449 行定义.
被这些函数引用 timer_scheduler< Clock >::add_task() , 以及 meta_type::meta_type().
|
noexcept |
| NEFORCE_ALWAYS_INLINE_INLINE bool name | ( | char * | buffer, |
| size_t | size ) |
获取当前线程名称
| buffer | 存储名称的缓冲区 |
| size | 缓冲区大小 |
在文件 thread.hpp 第 475 行定义.
引用了 thread::name() , 以及 size().
被这些函数引用 ini_document::add_section(), env_document::add_variable(), toml_builder::begin_array_table(), ini_builder::begin_section(), toml_builder::begin_table(), http_server_request::cookie(), cmdline::count(), environment::exists(), registry::find(), path_tree::find_all(), path_tree::node::find_child(), registry::find_unlocked(), type_builder< T >::function(), type_builder< T >::function(), environment::get(), env_document::get_bool(), env_document::get_double(), env_document::get_int(), env_document::get_int64(), plugin_manager::get_plugin(), ini_document::get_section(), ini_document::get_section(), env_document::get_string(), env_document::get_variable(), env_document::get_variable(), cmdline::has(), http_server_request::has_cookie(), http_server_request::has_header(), http_server_response::has_header(), http_server_request::has_parameter(), ini_document::has_section(), dynamic_library::has_symbol(), env_document::has_variable(), http_server_request::header(), http_server_response::header(), ini_section::ini_section(), http_server_request::parameter(), type_builder< T >::property(), reflect(), registry::register_type(), path_tree::node::remove_child(), env_document::remove_variable(), environment::set(), http_server_request::set_cookie(), http_server::set_cookie_name(), http_server_request::set_header(), http_server_response::set_header(), ini_section::set_name(), set_name(), http_server_request::set_parameter(), env_document::set_variable(), type_builder< T >::static_function(), dynamic_library::symbol(), dynamic_library::to_symbol(), type_builder< T >::type_builder(), plugin_manager::unload_plugin(), environment::unset() , 以及 ini_builder::value_section().
|
noexcept |
设置线程优先级
| priority | 优先级值 |
设置当前线程的调度优先级。
引用了 priority().
被这些函数引用 signal< Types >::connect(), signal< Types >::connect(), signal< Types >::connect_filtered(), signal< Types >::connect_if(), signal< Types >::connect_if(), signal< Types >::connect_signal(), signal< Types >::connect_signal(), signal< Types >::connect_transformed(), get_current_task_group(), priority(), thread_pool::submit_after(), thread_pool::submit_every() , 以及 thread_pool::submit_task().
|
noexcept |
|
noexcept |
根据计数进行线程放松
| count | 放松计数 |
根据计数值选择不同程度的放松策略:
在文件 this_thread.hpp 第 105 行定义.
引用了 count().
| NEFORCE_ALWAYS_INLINE_INLINE bool set_name | ( | const char * | name | ) |
| void sleep_for | ( | const duration< Rep, Period > | time | ) |
|
noexcept |
|
noexcept |
精确睡眠指定毫秒数
| ms | 要睡眠的毫秒数 |
| busy_wait | 是否使用忙等待获得更高精度 |
提供相对精确的睡眠功能。当use_busy_wait为true时,使用忙等待+系统睡眠组合 以获得更高的精度,但会增加CPU使用率。为false时使用纯系统睡眠。
|
noexcept |
精确睡眠指定纳秒数
| ns | 要睡眠的纳秒数 |
提供纳秒级精度的睡眠,主要用于极短时间延迟。
|
noexcept |
精确睡眠指定微秒数
| us | 要睡眠的微秒数 |
提供微秒级精度的睡眠,主要用于短时间延迟。
| void sleep_until | ( | const time_point< Clock, Dur > & | time | ) |
使当前线程睡眠直到指定时间点
| Clock | 时钟类型 |
| Dur | 持续时间类型 |
| time | 要睡眠到的时间点 |
跨平台的线程睡眠函数,支持稳定时钟和非稳定时钟。
在文件 clocks.hpp 第 174 行定义.
|
noexcept |
|
noexcept |