mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2025-06-12 06:45:31 +00:00
List<T> is now a really ugly macro. Added a workaround for jack.h not putting `void` in function prototypes for functions that take no arguments. I made upstream pull requests to jack1 and jack2 but I don't have high hopes about them getting merged. I removed the lock-free atomic asserts. clang reports non-lock-free atomics when in fact it does have lock-free atomics. I inspected the generated code for gcc and clang for fetch_add, load, and store, on x86_64 and armhf, and it's all lock free. Closes #45.
25 lines
576 B
C
25 lines
576 B
C
/*
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
*
|
|
* This file is part of libsoundio, which is MIT licensed.
|
|
* See http://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#ifndef SOUNDIO_RING_BUFFER_H
|
|
#define SOUNDIO_RING_BUFFER_H
|
|
|
|
#include "os.h"
|
|
#include "atomics.h"
|
|
|
|
struct SoundIoRingBuffer {
|
|
struct SoundIoOsMirroredMemory mem;
|
|
struct SoundIoAtomicLong write_offset;
|
|
struct SoundIoAtomicLong read_offset;
|
|
int capacity;
|
|
};
|
|
|
|
int soundio_ring_buffer_init(struct SoundIoRingBuffer *rb, int requested_capacity);
|
|
void soundio_ring_buffer_deinit(struct SoundIoRingBuffer *rb);
|
|
|
|
#endif
|