File: ring_buffer.hpp

package info (click to toggle)
libsoundio 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 904 kB
  • ctags: 1,502
  • sloc: cpp: 9,912; ansic: 1,821; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * 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_HPP
#define SOUNDIO_RING_BUFFER_HPP

#include "atomics.hpp"
#include "os.h"

struct SoundIoRingBuffer {
    SoundIoOsMirroredMemory mem;
    atomic_long write_offset;
    atomic_long read_offset;
    int capacity;
};

int soundio_ring_buffer_init(struct SoundIoRingBuffer *rb, int requested_capacity);
void soundio_ring_buffer_deinit(struct SoundIoRingBuffer *rb);

#endif