mpsc_t * mpsc_create(mpsc_create_params_t params)
The function used to create a new channel instance (i.e., a mpsc_t instance).
bool error_handling_enabled
A boolean value indicating whether (true) error handling should be handed over to the application or ...
Definition: mpsc.h:205
mpsc_register_producer_error_t mpsc_register_producer(mpsc_t *self, mpsc_producer_thread_callback_t callback, void *context)
The function used to register a new producer for self .
struct mpsc_producer_s mpsc_producer_t
An opaque data type used as a container for a MPSC channel's producer.
Definition: mpsc.h:86
void() mpsc_consumer_error_callback_t(mpsc_consumer_t *consumer)
The signature of an optional consumer error callback function, to be declared and implemented by the ...
Definition: mpsc.h:137
mpsc_register_producer_error_t mpsc_consumer_register_producer(mpsc_consumer_t *self, mpsc_producer_thread_callback_t callback, void *context)
An alias for mpsc_register_producer , but which is used on an object of type mpsc_consumer_t ,...
struct mpsc_consumer_s mpsc_consumer_t
An opaque data type used as a container for the MPSC channel's consumer.
Definition: mpsc.h:80
void mpsc_join(mpsc_t *self)
The function that must be called on self to wait for the channel close.
bool mpsc_producer_send(mpsc_producer_t *self, void *data, size_t n)
The function used (from inside a producer thread callback function) to send a message to the channel'...
size_t n_max_producers
The maximum number of producers that can be registered on the mpsc_t instance.
Definition: mpsc.h:173
bool create_and_join_thread_safety_disabled
A boolean value that can be used to disable the safety feature that prevents mpsc_create and mpsc_joi...
Definition: mpsc.h:211
void() mpsc_producer_thread_callback_t(mpsc_producer_t *producer)
The signature of the producer thread callback function, to be declared and implemented by the applica...
Definition: mpsc.h:96
bool mpsc_producer_send_empty(mpsc_producer_t *self)
Similar to mpsc_producer_send , except that this function is used (from inside a producer thread call...
bool mpsc_producer_ping(mpsc_producer_t *self)
A function that can be used from inside a producer thread callback to check whether the channel to wh...
void * mpsc_producer_context(mpsc_producer_t *self)
A function that can be used from inside the producer thread callback function to retrieve the applica...
mpsc_consumer_error_callback_t * consumer_error_callback
An optional, application defined producer thread callback function used, when error_handling_enabled ...
Definition: mpsc.h:188
void() mpsc_consumer_callback_t(mpsc_consumer_t *consumer, void *data, size_t n, bool closed)
The signature of the consumer callback function, to be declared and implemented by the application,...
Definition: mpsc.h:123
mpsc_register_producer_error_t
The type returned by mpsc_register_producer (as well as by its aliases; i.e., mpsc_producer_register_...
Definition: mpsc.h:43
@ MPSC_REGISTER_PRODUCER_ERROR_EAGAIN
The producer could not be registered because a EAGAIN error was observed when, internally,...
Definition: mpsc.h:65
@ MPSC_REGISTER_PRODUCER_ERROR_N_MAX_PRODUCERS_REACHED
The producer could not be registered because the maximum number of producers allowed (i....
Definition: mpsc.h:58
@ MPSC_REGISTER_PRODUCER_ERROR_CLOSED
The producer could not be registered because the mpsc_t instance has internally been marked as closed...
Definition: mpsc.h:52
@ MPSC_REGISTER_PRODUCER_ERROR_NONE
The producer was successfully registered.
Definition: mpsc.h:47
struct mpsc_s mpsc_t
An opaque data type used as a container for the MPSC channel data.
Definition: mpsc.h:74
size_t buffer_size
The size (in bytes) of the internal buffer used to transfer a message between a producer and the cons...
Definition: mpsc.h:163
mpsc_register_producer_error_t mpsc_producer_register_producer(mpsc_producer_t *self, mpsc_producer_thread_callback_t callback, void *context)
An alias for mpsc_register_producer , but which is used on an object of type mpsc_producer_t ,...
void mpsc_consumer_close(mpsc_consumer_t *self)
A function that can be used (from inside the application defined consumer callback implementing mpsc_...
mpsc_consumer_callback_t * consumer_callback
The application defined consumer callback function to be used to received messages for the mpsc_t ins...
Definition: mpsc.h:178
The structure that must be passed to mpsc_create to instantiate a new mpsc_t object.
Definition: mpsc.h:145