1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (c) 2012 Peter Brinkmann (peter.brinkmann@gmail.com)
*
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
*
* See https://github.com/libpd/libpd/wiki for documentation
*
*/
/// simple lock-free ring buffer implementation for one writer thread
/// and one consumer thread
typedef struct ring_buffer ring_buffer;
/// create a ring buffer, size must be a multiple of 256
/// returns NULL on failure
ring_buffer *;
/// free a ring buffer
void ;
/// get the number of bytes that can currently be written
/// this is safe to call from any thread
int ;
/// get the number of bytes that can currently be read
/// this is safe to called from any thread
int ;
/// write bytes from n sources to the ring buffer (if the ring buffer has
/// enough space), varargs are pairs of type (const char*, int) giving a pointer
/// to a buffer and the number of bytes to be copied
/// note: call this from a single writer thread only
/// returns 0 on success
int ;
/// writes single byte value n times to the ring buffer (if the ring buffer has
/// enough space)
/// note: call this from a single writer thread only
/// returns 0 on success
int ;
/// read given number of bytes from the ring buffer to dest (if the ring
/// buffer has enough data)
/// note: call this from a single reader thread only
/// returns 0 on success
int ;
/// clears the contents of the ring buffer
/// this is safe to call from any thread
void ;