Solved one very narrow timeframe where destruction race was possible.

git-svn-id: http://yate.null.ro/svn/yate/trunk@1284 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-04-20 16:53:40 +00:00
parent 954d991b2f
commit cd702d2885
1 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@ private:
bool m_autoclose;
bool m_autoclean;
bool m_nodata;
bool m_derefOk;
volatile bool m_derefOk;
};
class WaveConsumer : public DataConsumer
@ -365,8 +365,10 @@ void WaveSource::run()
tpos += (r*(u_int64_t)1000000/m_brate);
} while (r > 0);
Debug(&__plugin,DebugAll,"WaveSource '%s' end of data (%u played) chan=%p [%p]",m_id.c_str(),m_total,m_chan,this);
// prevent disconnector thread from succeeding before notify returns
m_derefOk = false;
// at cleanup time deref the data source if we start no disconnector thread
m_autoclean = m_derefOk = !notify(this,"eof");
m_derefOk = m_autoclean = !notify(this,"eof");
}
void WaveSource::cleanup()