foxygit / doom Log in
commit 1398c8aed38b0d42e7081410ae1710858d335f7e
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Feb 27 17:48:25 2010 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Feb 27 17:48:25 2010 +0000

    Fix race condition with condition variable freed before it is signaled.

    Subversion-branch: /branches/opl-branch
    Subversion-revision: 1873
---
 opl/opl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/opl/opl.c b/opl/opl.c
index 9e674530..6d0e16db 100644
--- a/opl/opl.c
+++ b/opl/opl.c
@@ -415,9 +415,10 @@ static void DelayCallback(void *_delay_data)

     SDL_LockMutex(delay_data->mutex);
     delay_data->finished = 1;
-    SDL_UnlockMutex(delay_data->mutex);

     SDL_CondSignal(delay_data->cond);
+
+    SDL_UnlockMutex(delay_data->mutex);
 }

 void OPL_Delay(unsigned int ms)