diff options
-rw-r--r-- | Alc/alcRing.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Alc/alcRing.c b/Alc/alcRing.c index 8ae7ab62..23195283 100644 --- a/Alc/alcRing.c +++ b/Alc/alcRing.c @@ -70,7 +70,13 @@ void DestroyRingBuffer(RingBuffer *ring) ALsizei RingBufferSize(RingBuffer *ring) { - return (ring->write_pos-ring->read_pos-1+ring->length) % ring->length; + ALsizei s; + + EnterCriticalSection(&ring->cs); + s = (ring->write_pos-ring->read_pos-1+ring->length) % ring->length; + LeaveCriticalSection(&ring->cs); + + return s; } void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len) @@ -115,4 +121,3 @@ void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len) LeaveCriticalSection(&ring->cs); } - |