MCPcopy Create free account
hub / github.com/Netis/cloud-probe / spsc_ring_create

Function spsc_ring_create

cpworker/src/ring_buffer.c:158–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156};
157
158spsc_ring_t *spsc_ring_create(size_t size)
159{
160 spsc_ring_t *r = malloc(sizeof(spsc_ring_t));
161 if (!r)
162 return NULL;
163
164 r->size = size;
165 r->buf = calloc(size, sizeof(ring_msg_t *));
166 if (!r->buf)
167 {
168 free(r);
169 return NULL;
170 }
171 atomic_store_relaxed(&r->head, 0);
172 atomic_store_relaxed(&r->tail, 0);
173 return r;
174}
175
176void spsc_ring_destroy(spsc_ring_t *r)
177{

Callers 1

task_manager_newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected