A class used to obtain information about the current thread and, if native extensions are enabled, get/set its priority, affinity, or name.
More...
#include <BS_thread_pool.hpp>
|
| static std::optional< std::size_t > | get_index () noexcept |
| | Get the index of the current thread. If this thread belongs to a BS::thread_pool object, the return value will be an index in the range [0, N) where N == BS::thread_pool::get_thread_count(). Otherwise, for example if this thread is the main thread or an independent thread not in any pools, std::nullopt will be returned.
|
| |
| static std::optional< void * > | get_pool () noexcept |
| | Get a pointer to the thread pool that owns the current thread. If this thread belongs to a BS::thread_pool object, the return value will be a void pointer to that object. Otherwise, for example if this thread is the main thread or an independent thread not in any pools, std::nullopt will be returned.
|
| |
|
|
static thread_local std::optional< std::size_t > | my_index = std::nullopt |
| |
|
static thread_local std::optional< void * > | my_pool = std::nullopt |
| |
|
|
template<tp > |
| class | thread_pool |
| |
A class used to obtain information about the current thread and, if native extensions are enabled, get/set its priority, affinity, or name.
◆ get_index()
| static std::optional< std::size_t > BS::this_thread::get_index |
( |
| ) |
|
|
inlinestaticnoexcept |
Get the index of the current thread. If this thread belongs to a BS::thread_pool object, the return value will be an index in the range [0, N) where N == BS::thread_pool::get_thread_count(). Otherwise, for example if this thread is the main thread or an independent thread not in any pools, std::nullopt will be returned.
- Returns
- An
std::optional object, optionally containing a thread index.
978 {
979 return my_index;
980 }
◆ get_pool()
| static std::optional< void * > BS::this_thread::get_pool |
( |
| ) |
|
|
inlinestaticnoexcept |
Get a pointer to the thread pool that owns the current thread. If this thread belongs to a BS::thread_pool object, the return value will be a void pointer to that object. Otherwise, for example if this thread is the main thread or an independent thread not in any pools, std::nullopt will be returned.
- Returns
- An
std::optional object, optionally containing a pointer to a thread pool. Note that this will be a void pointer, so it must be cast to the desired instantiation of the BS::thread_pool template in order to use any member functions.
988 {
989 return my_pool;
990 }
The documentation for this class was generated from the following file: