Commit 4d6192ad authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use a ScopeLock around condition.wait()

parent 9f1ada89
...@@ -618,7 +618,9 @@ osx_output_play(AudioOutput *ao, const void *chunk, size_t size, ...@@ -618,7 +618,9 @@ osx_output_play(AudioOutput *ao, const void *chunk, size_t size,
{ {
OSXOutput *od = (OSXOutput *)ao; OSXOutput *od = (OSXOutput *)ao;
od->mutex.lock(); {
const ScopeLock protect(od->mutex);
while (true) { while (true) {
if (od->ring_buffer->write_available() > 0) if (od->ring_buffer->write_available() > 0)
break; break;
...@@ -626,7 +628,7 @@ osx_output_play(AudioOutput *ao, const void *chunk, size_t size, ...@@ -626,7 +628,7 @@ osx_output_play(AudioOutput *ao, const void *chunk, size_t size,
/* wait for some free space in the buffer */ /* wait for some free space in the buffer */
od->condition.wait(od->mutex); od->condition.wait(od->mutex);
} }
od->mutex.unlock(); }
return od->ring_buffer->push((uint8_t *) chunk, size); return od->ring_buffer->push((uint8_t *) chunk, size);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment