Introduced OpenThreads::Affinity support into osg::Camera, osg::GraphicsContext::Traitse, osgDB::DatabasePager and osgViewer::ViewerBase/Viewer/CompositeViewer.

Added ViewerBase::configureAffinity() to help with the setting of the affinity of camera, graphics context and pager threads
This commit is contained in:
Robert Osfield
2016-09-28 18:44:58 +01:00
parent 77c5e96ccb
commit ee97db3488
10 changed files with 161 additions and 91 deletions

View File

@@ -59,6 +59,15 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
/** set up windows and associated threads.*/
virtual void realize() = 0;
/** 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();
/** Set the processor affinity of main thread.*/
virtual void setProcessorAffinty(const OpenThreads::Affinity& affinity) { _affinity = affinity; }
OpenThreads::Affinity& getProcessorAffinty() { return _affinity; }
const OpenThreads::Affinity& getProcessorAffinty() const { return _affinity; }
enum ThreadingModel
{
SingleThreaded,
@@ -283,7 +292,7 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
virtual void getUsage(osg::ApplicationUsage& usage) const = 0;
bool getRequestRedraw() const { return _requestRedraw; }
bool getRequestContinousUpdate() const { return _requestContinousUpdate; }
protected:
@@ -318,6 +327,7 @@ protected:
bool _quitEventSetsDone;
bool _releaseContextAtEndOfFrameHint;
OpenThreads::Affinity _affinity;
ThreadingModel _threadingModel;
bool _threadsRunning;