MT Core (C++)
Core library for replacing C++ standard in project usage
|
Go to the source code of this file.
Classes | |
struct | mtcore::thread::SendOptionNoCallback< S > |
Select option to send a message without calling a callback on send. More... | |
struct | mtcore::thread::SendOption< S, Callback > |
Select option to send a message. More... | |
struct | mtcore::thread::BeforeOption< Clock, Duration, Callback > |
Option to add a timeout on select to ensure a path runs before a timeout If the timeout is hit, a timeout error will be returned from the select Will call a callback on timeout. More... | |
struct | mtcore::thread::BeforeOptionNoCallback< Clock, Duration > |
Option to add a timeout on select to ensure a path runs before a timeout If the timeout is hit, a timeout error will be returned from the select. More... | |
struct | mtcore::thread::ReceiveOption< R, Callback > |
Select option to receive a message and calls a callback on receive. More... | |
struct | mtcore::thread::Select<> |
Base case for a select statement Use the "select" method directly for instantiation. More... | |
struct | mtcore::thread::Select< CurOption, Options... > |
A stage of a select case Use the "select" method directly for instantiation. More... | |
Namespaces | |
namespace | mtcore |
Core library for C++ with Zig-related functionality. | |
namespace | mtcore::thread |
Thread-related namespace The methods and classes provided by this class are thread-safe Classes and methods provided outside of this class are not thread-safe (with the exception of malloc_alloc) This requires linking mtcore_thread to your application. | |
Enumerations | |
enum class | mtcore::thread::SelectErrors { mtcore::thread::SelectErrors::SELECT_TIMEOUT , mtcore::thread::SelectErrors::DEADLOCK_DETECTED , mtcore::thread::SelectErrors::NOT_READY } |
Errors for when a select statement fails SELECT_TIMEOUT and DEADLOCK_DETECTED are the only ones which will be bubbled up NOT_READY is an internal error to indicate loop continuation. More... | |
enum class | mtcore::thread::SelectOptionErrors { mtcore::thread::SelectOptionErrors::ATTEMPT_FAILED , mtcore::thread::SelectOptionErrors::SKIP , mtcore::thread::SelectOptionErrors::TIMEOUT } |
Errors indicating control flow from a select option ATTEMPT_FAILED indicates to try the next option SKIP indicates to forever skip this option TIMEOUT indicates that a timeout error should be raised and select execution should stop. More... | |
Functions | |
template<SelectOption... Options> | |
Result< void, SelectErrors > | mtcore::thread::select (Options... opts) |
Creates a "select statement" similar to Go's select statement, except this statement runs on thread-based primitives instead of coroutine-based primitives. | |
template<Sender S, typename Callback> | |
SendOption< S, Callback > | mtcore::thread::send_to (S &to, typename S::Message msg, const Callback &callback) |
Creates a select case which will try to send a message to a sender Option will call a callback on successful send. | |
template<Sender S> | |
SendOptionNoCallback< S > | mtcore::thread::send_to (S &to, typename S::Message msg) |
Creates a select case which will try to send a message to a sender. | |
template<typename Clock, typename Duration, typename Callback> | |
BeforeOption< Clock, Duration, Callback > | mtcore::thread::before (const std::chrono::time_point< Clock, Duration > &tp, const Callback &callback) |
The before option will timeout a select if an option is not hit before the target time point. | |
template<typename Clock, typename Duration> | |
BeforeOptionNoCallback< Clock, Duration > | mtcore::thread::before (const std::chrono::time_point< Clock, Duration > &tp) |
The before option will timeout a select if an option is not hit before the target time point. | |
template<typename Rep, typename Per, typename Callback> | |
auto | mtcore::thread::timeout (const std::chrono::duration< Rep, Per > &tp, const Callback &callback) |
Does a timeout relative to current time (e.g. | |
template<typename Rep, typename Per> | |
auto | mtcore::thread::timeout (const std::chrono::duration< Rep, Per > &tp) |
Does a timeout relative to current time (e.g. | |
template<Receiver R, typename Callback> | |
ReceiveOption< R, Callback > | mtcore::thread::receive_from (R &from, const Callback &callback) |
Creates a receive option for select which will execute when a message is ready. | |