From Matthew Johnson-Roberson, "Small fix for operation thread to protect the access to _operations vector by functions getNumOperationsInQueue() and empty(). It is simply an addition of OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
to protect against accessing while writing which was segfaulting in VPB specifically in void ThreadPool::run(osg::Operation* op) in the waiting loop while (_operationQueue->getNumOperationsInQueue() >= _maxNumberOfOperationsInQueue) "
This commit is contained in:
@@ -55,6 +55,19 @@ OperationQueue::~OperationQueue()
|
||||
{
|
||||
}
|
||||
|
||||
bool OperationQueue::empty()
|
||||
{
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
|
||||
return _operations.empty();
|
||||
}
|
||||
|
||||
unsigned int OperationQueue::getNumOperationsInQueue()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_operationsMutex);
|
||||
return static_cast<unsigned int>(_operations.size());
|
||||
}
|
||||
|
||||
ref_ptr<Operation> OperationQueue::getNextOperation(bool blockIfEmpty)
|
||||
{
|
||||
if (blockIfEmpty && _operations.empty())
|
||||
|
||||
Reference in New Issue
Block a user