# HG changeset patch # User Chris Cannam # Date 1242661443 0 # Node ID 2fc2a676877704ad0324e8c7e36434d49dd17b4f # Parent b97f4f926f48930a8f1f3f82ccd54ec86985e83e * Fix race condition diff -r b97f4f926f48 -r 2fc2a6768777 dsp/tempotracking/TempoTrack.cpp --- 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. */ diff -r b97f4f926f48 -r 2fc2a6768777 thread/AsynchronousTask.h --- 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) {