Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software 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 the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
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 thread_local std::optional< std::size_t > my_index = std::nullopt
 
static thread_local 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()

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: