14 #if defined(__clang__) || defined(__GNUG__) || defined(_MSC_VER)
15 #define restrict __restrict
32#define make_mpmc(N, T) mpmc_alloc((N), sizeof(T))
39#define sizeof_mpmc(N, T) mpmc_open(NULL, (N), sizeof(T))
43#define mpmc_send1(C, SRC) mpmc_send((C), 1, (SRC))
47#define mpmc_nbsend1(C, SRC) mpmc_nbsend((C), 1, (SRC))
51#define mpmc_recv1(C, DST) mpmc_recv((C), 1, (DST))
55#define mpmc_nbrecv1(C, DST) mpmc_nbrecv((C), 1, (DST))
70size_t mpmc_open(
void *c,
size_t nel,
size_t elsize);
Exclusive claims for directly reading/writing into channels.
size_t mpmc_nbrecv_init(struct mpmc *c, size_t n, struct claim *r)
Claims up to an amount of space in the channel to be manually read from.
size_t mpmc_nbsendv(struct mpmc *restrict c, size_t n,...)
Sends whatever items will fit to a channel.
bool mpmc_send_fini(struct mpmc *c, struct claim *s)
Commits a claim, indicating the item slots within are finished being written to and are ready to be r...
size_t mpmc_nbrecvv(struct mpmc *restrict c, size_t n,...)
Receives whatever items are available from a channel.
bool mpmc_close(struct mpmc *c)
Closes a channel, forbidding any future send operations on it.
bool mpmc_recv_fini(struct mpmc *c, struct claim *r)
Commits a claim, indicating the item slots within have been read from and are ready to be overwritten...
size_t mpmc_nbsend(struct mpmc *restrict c, size_t n, void *restrict src)
Sends whatever items will fit to a channel.
bool mpmc_nbsend_fini(struct mpmc *c, struct claim *s)
Tries to commit a claim, indicating the item slots within have been written to and are ready to be re...
bool mpmc_send(struct mpmc *restrict c, size_t n, void *restrict src)
Sends items to a channel.
bool mpmc_sendv(struct mpmc *restrict c, size_t n,...)
Sends items to a channel.
size_t mpmc_nbrecv(struct mpmc *restrict c, size_t n, void *restrict dst)
Receives whatever items are available from a channel.
bool mpmc_recv(struct mpmc *restrict c, size_t n, void *restrict dst)
Receives items from a channel.
size_t mpmc_nbsend_init(struct mpmc *c, size_t n, struct claim *s)
Claims up to an amount of space in the channel to be manually written into.
bool mpmc_recvv(struct mpmc *restrict c, size_t n,...)
Receives items from a channel.
bool mpmc_nbrecv_fini(struct mpmc *c, struct claim *r)
Tries to commit a claim, indicating the item slots within have been read from and are safe to be over...
bool mpmc_send_init(struct mpmc *c, size_t n, struct claim *s)
Claims space in the channel to be manually written into.
struct mpmc * mpmc_alloc(size_t nel, size_t elsize)
Allocates a new mpmc using malloc() and opens it.
size_t mpmc_open(void *c, size_t nel, size_t elsize)
Constructs a mpmc in-place, or calculates the needed allocation size for one.
bool mpmc_recv_init(struct mpmc *c, size_t n, struct claim *r)
Claims space in the channel to be manually read from.
Claimed space for reading or writing directly into the internal ringbuffer of a channel.
Definition claim.h:26
Multiple-producer, multiple-consumer channel.