changeset 68:09aba2ccd94a

* Fix race condition
author cannam
date Mon, 18 May 2009 15:44:03 +0000
parents 516c86946900
children 6afa0e011f74
files dsp/tempotracking/TempoTrack.cpp thread/AsynchronousTask.h
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dsp/tempotracking/TempoTrack.cpp	Thu May 14 12:45:08 2009 +0000
+++ b/dsp/tempotracking/TempoTrack.cpp	Mon May 18 15:44:03 2009 +0000
@@ -4,7 +4,7 @@
     QM DSP Library
 
     Centre for Digital Music, Queen Mary, University of London.
-    This file copyright 2005-2006 Christian Landone.
+    This file copyright 2005-2006 Christian Landone and Matthew Davies.
     All rights reserved.
 */
 
--- a/thread/AsynchronousTask.h	Thu May 14 12:45:08 2009 +0000
+++ b/thread/AsynchronousTask.h	Mon May 18 15:44:03 2009 +0000
@@ -68,6 +68,7 @@
         m_todo.unlock();
     }
     void awaitTask() {
+        m_done.lock();
         while (m_inTask) m_done.wait();
         m_done.unlock();
     }
@@ -82,6 +83,8 @@
                 m_todo.wait();
             }
             if (m_finishing) {
+                m_inTask = false;
+                m_done.signal();
                 break;
             }
             if (m_inTask) {