Hey Robert,

I took a look at this and I think Remo is right.  Basically the issue is
that if you do anything that forces the osgDB library to be loaded before
you have a chance to set your desired settings in osg::DisplaySettings then
they won't take effect b/c the prototype DatabasePager is created here on
library load:
https://github.com/openscenegraph/OpenSceneGraph/blob/10d8ac7f65b177a3a92a28e2f976413c9c641489/src/osgDB/DatabasePager.cpp#L1243

So if you happen to do what Remo is doing by using osgDB to get the number
of processors, your DisplaySettings won't take effect b/c the prototype
pager has already been created.

I've been bit by this a few times as well, so it's something worth looking
at.  It's also a hard problem to track down b/c it just usually manifests
itself as "Why is osgearth slow in my app but not in osgviewer"

Perhaps the answer is to create the prototype on demand instead of on
library load?

Jason

On Sun, Apr 30, 2017 at 12:31 PM Remo Eichenberger <[email protected]> wrote:

> Hi Robert
>
> How one should change the number of threads dynamic before DatabasePager
> initialise it in his singleton?
>
>
> Code:
>
> int cores = Registry::capabilities().getNumProcessors();
> osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint(
> osg::clampAbove(cores, 2) );
> osg::DisplaySettings::instance()->setNumOfHttpDatabaseThreadsHint(
> osg::clampAbove(cores/2, 1) );
>
>
>
>
> It will not work. It works only with an environment variable. The
> singleton should not setup the threads on startup. The constructor of a
> singleton is at beginning of application startup. The order of initialise
> is not defined (only from the compiler).
>
> Cheers,
> Remo
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70866#70866
>
>
>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to