Added explicit calls cancel and wait until thread and no longer running to the
DatabasePager and TXP pager.
This commit is contained in:
@@ -115,7 +115,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~DatabasePager() {}
|
||||
virtual ~DatabasePager();
|
||||
|
||||
struct DatabaseRequest : public osg::Referenced
|
||||
{
|
||||
|
||||
@@ -97,8 +97,6 @@ bool osg::isGLExtensionSupported(const char *extension)
|
||||
|
||||
}
|
||||
|
||||
std::cout<<"render='"<<renderer<<"'"<<std::endl;
|
||||
|
||||
if (renderer.empty())
|
||||
{
|
||||
extensionDisabled = true;
|
||||
|
||||
@@ -21,6 +21,26 @@ DatabasePager::DatabasePager()
|
||||
_expiryDelay = 1.0;
|
||||
}
|
||||
|
||||
DatabasePager::~DatabasePager()
|
||||
{
|
||||
if( isRunning() )
|
||||
{
|
||||
// cancel the thread..
|
||||
cancel();
|
||||
//join();
|
||||
|
||||
// then wait for the the thread to stop running.
|
||||
while(isRunning())
|
||||
{
|
||||
std::cout<<"Waiting for RenderSurface to cancel"<<std::endl;
|
||||
//OpenThreads::Thread::YieldCurrentThread();
|
||||
OpenThreads::Thread::Yield();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group)
|
||||
{
|
||||
|
||||
|
||||
@@ -152,7 +152,16 @@ bool OSGPageManager::EndThread()
|
||||
if( pagingThread.isRunning() )
|
||||
{
|
||||
pagingThread.cancel();
|
||||
pagingThread.join();
|
||||
//pagingThread.join();
|
||||
|
||||
// then wait for the the thread to stop running.
|
||||
while(pagingThread.isRunning())
|
||||
{
|
||||
std::cout<<"Waiting for TXP pager thread to cancel"<<std::endl;
|
||||
//OpenThreads::Thread::YieldCurrentThread();
|
||||
OpenThreads::Thread::Yield();
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user