Ordering and Threads
order_t
An order_t
is a strongly typed std::size_t
. This specifies the delay to apply in the event loop in nanoseconds (0 for no delay).
thread_t
A thread_t
is a strongly typed std::uint16_t
which is used to select a thread to be used. This can have different meaning in different contexts. Typically thread_t::any_thread()
can be used to select which thread currently has the least amount of work to do. Thread bounds are not checked, so specifying an index larger than the number of threads in the engine
is undefined behavior.
-
struct zab::thread_t
A struct for providing strict typing of thread ids’.
Public Members
-
std::uint16_t thread_ = kAnyThread
The logical id of the thread.
Public Static Functions
Public Static Attributes
-
static constexpr auto kAnyThread = std::numeric_limits<std::uint16_t>::max() - 1
This value signifies either no thread or any thread is allowed.
Friends
- friend constexpr friend bool operator== (const thread_t _first, const thread_t _second)=default
Equality operator is default.
- Parameters
_first – The lhs
_second – The rhs
- Returns
true If equal
- Returns
false If not equal
- friend constexpr friend bool operator!= (const thread_t _first, const thread_t _second)=default
Inequality operator is default.
- Parameters
_first – The lhs.
_second – The rhs.
- Returns
true If not equal
- Returns
false If equal
- inline friend constexpr friend auto operator<=> (const thread_t _first, const thread_t _second)
3-way operator is default for a std::strong_ordering.
- Parameters
_first – The lhs.
_second – The rhs.
- template<std::integral T> inline friend constexpr friend auto operator<=> (const thread_t _first, const T _number)
3-way operator with a std::integral for a std::strong_ordering.
- Parameters
_first – The lhs.
_second – The rhs.
- template<std::integral T> inline friend constexpr friend bool operator== (const thread_t _first, const T _second)
Equality operator with a std::integral.
- Parameters
_first – The lhs
_second – The rhs
- Returns
true If equal
- Returns
false If not equal
- template<std::integral T> inline friend constexpr friend bool operator!= (const thread_t &_first, const T _second)
Inequality operator with a std::integral.
- Parameters
_first – The lhs
_second – The rhs
- Returns
true If equal
- Returns
false If not equal
-
std::uint16_t thread_ = kAnyThread