diff --git a/include/osgViewer/ViewerBase b/include/osgViewer/ViewerBase index 66418f653..c13b0cb65 100644 --- a/include/osgViewer/ViewerBase +++ b/include/osgViewer/ViewerBase @@ -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; diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index c3c1eb541..467d7e0d4 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -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);