|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
Go to the source code of this file.
Macros | |
| #define | MIN_MAG 2 |
| #define | MAX_MAG MAX_POW2_EXP_FOR_UNSIGNED(SRN_SPSC_RING_CAP_TYPE) |
Functions | |
| srn_spsc_ring_t * | srn_spsc_ring_make (srn_context_t *ctx, size_t magnitude, size_t elem_size) |
| Set up a ring by allocating the buf to be the size of cap * elem_size. | |
| bool | srn_spsc_ring_push (srn_spsc_ring_t *r, const void *elem) |
| Producer side. | |
| bool | srn_spsc_ring_pop (srn_spsc_ring_t *r, void *out) |
| Consumer side. | |
| bool | srn_spsc_ring_empty (const srn_spsc_ring_t *r) |
| Whether the ring currently holds no elements. | |
| #define MAX_MAG MAX_POW2_EXP_FOR_UNSIGNED(SRN_SPSC_RING_CAP_TYPE) |
Definition at line 25 of file spsc_ring.c.
| #define MIN_MAG 2 |
Definition at line 24 of file spsc_ring.c.
| bool srn_spsc_ring_empty | ( | const srn_spsc_ring_t * | r | ) |
Whether the ring currently holds no elements.
For the consumer this is exact; for any other observer it is a hint.
Definition at line 103 of file spsc_ring.c.
| srn_spsc_ring_t * srn_spsc_ring_make | ( | srn_context_t * | ctx, |
| size_t | magnitude, | ||
| size_t | elem_size ) |
Set up a ring by allocating the buf to be the size of cap * elem_size.
And it will choose the cap to be 2 ^ magnitude.
Definition at line 27 of file spsc_ring.c.
| bool srn_spsc_ring_pop | ( | srn_spsc_ring_t * | r, |
| void * | out ) |
Consumer side.
Copy one element into *out. Returns false when the ring is empty, leaving *out untouched.
Definition at line 83 of file spsc_ring.c.
| bool srn_spsc_ring_push | ( | srn_spsc_ring_t * | r, |
| const void * | elem ) |
Producer side.
Copy *elem into the ring. Returns false when the ring is full, leaving it unchanged.
Definition at line 61 of file spsc_ring.c.