aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alcRing.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-06-04 17:01:44 -0700
committerChris Robinson <[email protected]>2008-06-04 17:01:44 -0700
commit10a87f510c8a4b2f175a06a0b2f731cd68ee227f (patch)
tree227dfbd4704cf2dc14722b289e4108b2a14e9e6e /Alc/alcRing.c
parentca6feeda2900acc4ea9b160402e4d4f10c92c8f5 (diff)
Protect RingBufferSize calculation with the mutex
Diffstat (limited to 'Alc/alcRing.c')
-rw-r--r--Alc/alcRing.c9
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);
}
-