Added ViewerBase::s/getUseConfigureAffinity(bool flag) to allow users to toggle whether they want the ViewerBase::setUpThreads() method to call ViewerBase::configureAffinity() or not.

This commit is contained in:
Robert Osfield 2016-09-28 20:30:12 +01:00
parent ee97db3488
commit 91538d90f8
2 changed files with 11 additions and 2 deletions

View File

@ -60,6 +60,12 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
virtual void realize() = 0;
/** Set whether the setUpThreading() method should call configureAffinity() to set up up the processor affinity of viewer threads.*/
void setUseConfigureAffinity(bool flag) { _useConfigureAffinity = flag; }
/** get whether the setUpThreading() method should call configureAffinity() to set up up the processor affinity of viewer threads.*/
bool getUseConfigureAffinity() const { return _useConfigureAffinity; }
/** analyse the viewer configuration and select an appropriate Affinity for main thread, and any graphics, camera threads and database pagers that are required.*/
virtual void configureAffinity();
@ -327,6 +333,7 @@ protected:
bool _quitEventSetsDone;
bool _releaseContextAtEndOfFrameHint;
bool _useConfigureAffinity;
OpenThreads::Affinity _affinity;
ThreadingModel _threadingModel;
bool _threadsRunning;

View File

@ -80,6 +80,8 @@ void ViewerBase::viewerBaseInit()
{
_runMaxFrameRate = osg::asciiToDouble(str);
}
_useConfigureAffinity = true;
}
void ViewerBase::configureAffinity()
@ -235,8 +237,8 @@ void ViewerBase::setUpThreading()
_threadingModel = suggestBestThreadingModel();
}
// configure affinity before we start threads
configureAffinity();
// if required configure affinity before we start threads
if (_useConfigureAffinity) configureAffinity();
Contexts contexts;
getContexts(contexts);