osgEarth 2.1.1
|
Public Member Functions | |
TaskThread (TaskRequestQueue *queue) | |
bool | getDone () |
void | setDone (bool done) |
void | run () |
int | cancel () |
Private Attributes | |
osg::ref_ptr< TaskRequestQueue > | _queue |
osg::ref_ptr< TaskRequest > | _request |
volatile bool | _done |
Definition at line 147 of file TaskService.
TaskThread::TaskThread | ( | TaskRequestQueue * | queue | ) |
Definition at line 168 of file TaskService.cpp.
int TaskThread::cancel | ( | ) |
Definition at line 221 of file TaskService.cpp.
bool osgEarth::TaskThread::getDone | ( | ) | [inline] |
Definition at line 150 of file TaskService.
{ return _done;}
void TaskThread::run | ( | ) |
Definition at line 176 of file TaskService.cpp.
{ while( !_done ) { _request = _queue->get(); if ( _done ) break; if (_request.valid()) { // discard a completed or canceled request: if ( _request->getState() != TaskRequest::STATE_PENDING ) { _request->cancel(); } else if ( !_request->wasCanceled() ) { if ( _request->getProgressCallback() ) _request->getProgressCallback()->onStarted(); _request->setState( TaskRequest::STATE_IN_PROGRESS ); _request->run(); //OE_INFO << LC << "Task \"" << _request->getName() << "\" runtime = " << _request->runTime() << " s." << std::endl; } else { //OE_INFO << LC << "Task \"" << _request->getName() << "\" was cancelled before it ran." << std::endl; } _request->setState( TaskRequest::STATE_COMPLETED ); // signal the completion of a request. if ( _request->getProgressCallback() ) _request->getProgressCallback()->onCompleted(); // Release the request _request = 0; } } }
void osgEarth::TaskThread::setDone | ( | bool | done | ) | [inline] |
Definition at line 151 of file TaskService.
{ _done = done; }
volatile bool osgEarth::TaskThread::_done [private] |
Definition at line 158 of file TaskService.
osg::ref_ptr<TaskRequestQueue> osgEarth::TaskThread::_queue [private] |
Definition at line 156 of file TaskService.
osg::ref_ptr<TaskRequest> osgEarth::TaskThread::_request [private] |
Definition at line 157 of file TaskService.