From e240351d81105e233f02d006f6bf42d03c0dd09b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 1 Feb 2018 18:09:16 -0800 Subject: Use a semaphore to signal the event handler Semaphores allow for semi-persistent signals, compared to a condition variable which requires a mutex for proper detection. A semaphore can be 'post'ed after writing some data on one thread, and another thread will be able to recognize it quickly even if the post occured in between checking for data and waiting. This more correctly fixes a race condition with events since the mixer shouldn't be using mutexes, and arbitrary wake-ups just to make sure an event wasn't missed was quite inefficient. --- OpenAL32/Include/alMain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e7a95eef..bc5a27c8 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -675,7 +675,7 @@ struct ALCcontext_struct { almtx_t EventThrdLock; althrd_t EventThread; - alcnd_t EventCnd; + alsem_t EventSem; struct ll_ringbuffer *AsyncEvents; ATOMIC(ALbitfieldSOFT) EnabledEvts; almtx_t EventCbLock; -- cgit v1.2.3