RoveComm C++ 3.0.0
Welcome to the RoveComm C++ repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of RoveComm C++. The RoveComm C++ project is the RoveComm interface for high level systems and should not be used for microcontrollers.
Loading...
Searching...
No Matches
BS::this_thread Class Reference

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 Public Member Functions

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 Private Attributes

static std::optional< std::size_t > my_index = std::nullopt
static std::optional< void * > my_pool = std::nullopt

Friends

template<tp>
class thread_pool

Detailed Description

A class used to obtain information about the current thread and, if native extensions are enabled, get/set its priority, affinity, or name.

Member Function Documentation

◆ get_index()

std::optional< std::size_t > BS::this_thread::get_index ( )
inlinestaticnodiscardnoexcept

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 }
static std::optional< std::size_t > my_index
Definition BS_thread_pool.hpp:1347

◆ get_pool()

std::optional< void * > BS::this_thread::get_pool ( )
inlinestaticnodiscardnoexcept

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 }
static std::optional< void * > my_pool
Definition BS_thread_pool.hpp:1348
Here is the caller graph for this function:

◆ thread_pool

template<tp>
friend class thread_pool
friend

Member Data Documentation

◆ my_index

std::optional<std::size_t> BS::this_thread::my_index = std::nullopt
inlinethread_localstaticprivate

◆ my_pool

std::optional<void*> BS::this_thread::my_pool = std::nullopt
inlinethread_localstaticprivate

The documentation for this class was generated from the following file: