summaryrefslogtreecommitdiff
path: root/src/shared/container/ring.h
blob: 434f6aa7a8833785904b3123ce5bbe0cc1b4a6b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once
#include <stddef.h>
#include <stdint.h>

typedef struct {
	void *buf;
	size_t capacity;
	size_t _head, _tail;
} ring_t;

size_t	ring_size(ring_t*);

void	ring_put(ring_t*, void*, size_t);
void	ring_put1b(ring_t*, uint8_t);

size_t	ring_get(ring_t*, void*, size_t);