Added explicit calls cancel and wait until thread and no longer running to the

DatabasePager and TXP pager.
This commit is contained in:
Robert Osfield
2003-08-20 12:52:33 +00:00
parent 18abc3aff7
commit 1a68dd80d7
4 changed files with 31 additions and 4 deletions

View File

@@ -115,7 +115,7 @@ class OSGDB_EXPORT DatabasePager : public osg::NodeVisitor::DatabaseRequestHandl
protected :
virtual ~DatabasePager() {}
virtual ~DatabasePager();
struct DatabaseRequest : public osg::Referenced
{

View File

@@ -97,8 +97,6 @@ bool osg::isGLExtensionSupported(const char *extension)
}
std::cout<<"render='"<<renderer<<"'"<<std::endl;
if (renderer.empty())
{
extensionDisabled = true;

View File

@@ -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)
{

View File

@@ -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;
}