Commit 51e00536 authored by David Reid's avatar David Reid

Fix a possible deadlock.

Public issue https://github.com/mackron/miniaudio/issues/919
parent d6282845
...@@ -42525,6 +42525,7 @@ MA_API ma_result ma_device_start(ma_device* pDevice) ...@@ -42525,6 +42525,7 @@ MA_API ma_result ma_device_start(ma_device* pDevice)
while another was waiting on the mutex. while another was waiting on the mutex.
*/ */
if (ma_device_get_state(pDevice) == ma_device_state_started) { if (ma_device_get_state(pDevice) == ma_device_state_started) {
ma_mutex_unlock(&pDevice->startStopLock);
return MA_SUCCESS; /* Already started. */ return MA_SUCCESS; /* Already started. */
} }
...@@ -42593,6 +42594,7 @@ MA_API ma_result ma_device_stop(ma_device* pDevice) ...@@ -42593,6 +42594,7 @@ MA_API ma_result ma_device_stop(ma_device* pDevice)
while another was waiting on the mutex. while another was waiting on the mutex.
*/ */
if (ma_device_get_state(pDevice) == ma_device_state_stopped) { if (ma_device_get_state(pDevice) == ma_device_state_stopped) {
ma_mutex_unlock(&pDevice->startStopLock);
return MA_SUCCESS; /* Already stopped. */ return MA_SUCCESS; /* Already stopped. */
} }
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