Fixed thread exit problems

This commit is contained in:
Robert Osfield
2009-03-08 16:48:48 +00:00
parent 7473b06275
commit 73c2615d17
7 changed files with 48 additions and 5 deletions

View File

@@ -34,10 +34,15 @@ FFmpegDecoderVideo::~FFmpegDecoderVideo()
{
osg::notify(osg::NOTICE)<<"Destructing FFmpegDecoderVideo..."<<std::endl;
if (isRunning())
{
m_exit = true;
#if 0
while(isRunning()) { OpenThreads::YieldCurrentThread(); }
#else
join();
#endif
}
#ifdef USE_SWSCALE
@@ -102,6 +107,16 @@ void FFmpegDecoderVideo::open(AVStream * const stream)
}
void FFmpegDecoderVideo::close(bool waitForThreadToExit)
{
m_exit = true;
if (isRunning() && waitForThreadToExit)
{
while(isRunning()) { OpenThreads::Thread::YieldCurrentThread(); }
}
}
void FFmpegDecoderVideo::run()
{