[osg-users] SingleThreaded leading to whole application just running on one core

Robert Osfield robert.osfield at gmail.com
Mon Sep 26 06:14:12 PDT 2016

Hi Sebastian,

On 26 September 2016 at 12:15, Sebastian Messerschmidt
<sebastian.messerschmidt at gmx.de> wrote:
> Would a small function to enable/disable the affinity in SingleThreaded mode
> be a big breaking change? Defaulting to using the affinity mask, making it
> up to the advanced user to sacrifice the performance.

I would rather avoid small code changes that don't actual offer any
path forward.  Adding a bool for the affinity would just be a
workaround for an issue which is somewhere else entirely, it would be
just another hack.

> I would argue that the the issue isn't that specific when seen in a greater
> context. In my case OSG is used behind an interface, so it might not be
> possible to use create threads before the viewer.

If you are using OpenThreads for your threads then you have no problem
at all anyway, you can create them before or after viewer.realizer()
without any problem.

It's only if you create your threads afterwards using another
threading library that doesn't set the affinity mask in any way so
just inherits the infinity mask.

A number of contributors to this thread have made it out to be a
general problem, it's not, it's a very specific usage case issue.

> Also it simply feels like an inappropriate side-effect which is buried
> without having control/access over/to it.

The side effect is only in certain circumstances, it's unwanted, but
it's not something that most users will likely hit up against.  You
also do have control over, you can set the affinity mask for your
threads rather than inherit what ever mask has be previously set.


I would add though I'm not opposed to adding more control of the
affinity to OpenThreads/OSG.  What API form this extra control might
take I can't say at this point as I haven't had to time to reflect on
the issue enough.  I still have plenty of other tasks to get on with.


More information about the osg-users mailing list