MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
pub_sub.hpp File Reference
#include "mtcore/colls/gen_list.hpp"
#include "mtcore_thread/arc.hpp"
#include "mtcore_thread/core.hpp"
#include "mtcore/alloc.hpp"
#include "mtcore_thread/traits.hpp"
#include <memory>
Include dependency graph for pub_sub.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mtcore::thread::Subscription< T >
 Represents a pub/sub subscription which can receive messages of type T Under the hood, each publisher maintains a message broker which stores all messages Subscribers will hold an Arc to the broker and will retrieve messages from the broker Due to the broker being shared, it does require more locks for both reads and writes This means it has a pretty low throughput when there is lots of contention The primary advantage is it has a much more convenient API for more non-blocking operations or timed blocks The reason this happens is that publishers are given greater insight into each subscription, and can better avoid partial writes. More...
 
struct  mtcore::thread::Publisher< T >
 Represents a pub/sub publisher which can publish messages of type T Supports blocking and non-blocking publishing. 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::PubSubSendBlockGrowErrors { mtcore::thread::PubSubSendBlockGrowErrors::CHANNEL_CLOSED , mtcore::thread::PubSubSendBlockGrowErrors::PARTIAL_SEND , mtcore::thread::PubSubSendBlockGrowErrors::ALLOCATION_FAILED }
 Errors for when blocking publishing fails. More...
 
enum class  mtcore::thread::PubSubSendBeforeGrowsError { mtcore::thread::PubSubSendBeforeGrowsError::CHANNEL_CLOSED , mtcore::thread::PubSubSendBeforeGrowsError::TIMEOUT , mtcore::thread::PubSubSendBeforeGrowsError::PARTIAL_SEND , mtcore::thread::PubSubSendBeforeGrowsError::ALLOCATION_FAILED }
 Errors for when timed blocking publishing fails. More...
 
enum class  mtcore::thread::PubSubTrySendGrowsError {
  mtcore::thread::PubSubTrySendGrowsError::CHANNEL_CLOSED , mtcore::thread::PubSubTrySendGrowsError::COULD_NOT_LOCK , mtcore::thread::PubSubTrySendGrowsError::NO_ROOM , mtcore::thread::PubSubTrySendGrowsError::PARTIAL_SEND ,
  mtcore::thread::PubSubTrySendGrowsError::ALLOCATION_FAILED
}
 Errors for when non-blocking publishing fails. More...