|
void DatabasePager::requestNodeFile(const std::string& fileName,osg::Group* group,
float priority, const osg::FrameStamp* framestamp,
osg::ref_ptr& databaseRequestRef,
ReaderWriter::Options* loadOptions)
{
if (previousFrame!=frameNumber)
{
// osg::notify(osg::NOTICE)<<"requestNodeFiles for "<
RequestQueue* requestQueue = databaseRequest->_requestQueue;
if (requestQueue)
{
// 这儿判断等于1是什么意思
if (databaseRequestRef->referenceCount()==1)
{
osg::notify(osg::INFO)<<"DatabasePager::fileRquest("<
databaseRequest->_frameNumberFirstRequest = frameNumber;
databaseRequest->_timestampFirstRequest = timestamp;
databaseRequest->_priorityFirstRequest = priority;
databaseRequest->_frameNumberLastRequest = frameNumber;
databaseRequest->_timestampLastRequest = timestamp;
databaseRequest->_priorityLastRequest = priority;
databaseRequest->_groupForAddingLoadedSubgraph = group;
databaseRequest->_loadOptions = loadOptions;
databaseRequest->_requestQueue = _fileRequestQueue.get();
_fileRequestQueue->add(databaseRequest);
}
}
}
// 这儿判断什么意思
if (!foundEntry)
{
osg::notify(osg::INFO)<<"In DatabasePager::fileRquest("<
OpenThreads::ScopedLock lock(_fileRequestQueue->_requestMutex);
if (!databaseRequestRef.valid() || databaseRequestRef->referenceCount()==1)
{
osg::ref_ptr databaseRequest = new DatabaseRequest;
databaseRequestRef = databaseRequest.get();
databaseRequest->_fileName = fileName;
databaseRequest->_frameNumberFirstRequest = frameNumber;
databaseRequest->_timestampFirstRequest = timestamp;
databaseRequest->_priorityFirstRequest = priority;
databaseRequest->_frameNumberLastRequest = frameNumber;
databaseRequest->_timestampLastRequest = timestamp;
databaseRequest->_priorityLastRequest = priority;
databaseRequest->_groupForAddingLoadedSubgraph = group;
databaseRequest->_loadOptions = loadOptions;
databaseRequest->_requestQueue = _fileRequestQueue.get();
_fileRequestQueue->_requestList.push_back(databaseRequest.get());
_fileRequestQueue->updateBlock();
}
}
// 这儿判断什么意思
if (!_startThreadCalled)
{
OpenThreads::ScopedLock lock(_run_mutex);
if (!_startThreadCalled)
{
_startThreadCalled = true;
_done = false;
osg::notify(osg:EBUG_INFO)<<"DatabasePager::startThread()"<
if (_databaseThreads.empty())
{
setUpThreads(
osg::DisplaySettings::instance()->getNumOfDatabaseThreadsHint(),
osg::DisplaySettings::instance()->getNumOfHttpDatabaseThreadsHint());
}
for(DatabaseThreadList::const_iterator dt_itr = _databaseThreads.begin();
dt_itr != _databaseThreads.end();
++dt_itr)
{
(*dt_itr)->startThread();
}
}
}
totalTime += osg::Timer::instance()->delta_m(start_tick, osg::Timer::instance()->tick());
}
请高手多指点! |
|