[osg-users] [build] ViewerBase::setThreadingModel() not working

Robert Osfield robert.osfield at gmail.com
Thu Jul 12 08:55:02 PDT 2018


Hi Guy,

The commit that changes this was:

ommit bb84f1ea3c23625a645b9c2848202bca7c566efb
Author: Konstantin S. Matveyev <root at zorro.ev>
Date:   Sat Jan 13 15:46:53 2018 +0300

    osgViewer::ViewerBase setThreadingModel func fix: should not start
threading, must only restart

Off the top of my head I only vaguely recall the motivation for the
change.  Have a look at the mailing list/forum archives and the commit
on github to see any discussions about this from early January,

Robert.

On Thu, 12 Jul 2018 at 16:21, Guy Volckaert <guy.volckaert at meggitt.com> wrote:
>
> Hi,
>
> When I try to cycle through the threading models by pressing the 'm' key (when the ThreadingHandler is registered) the stats would indicates the correct threading model, but the engine would remain in SingleThreaded. So I started investigating the issue and I noticed that, with OSG v3.6.2, the ViewerBase::setThreadingModel() changed compared with v3.4.0. Below is a snipit of function:
>
>
> Code:
>
> void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
> {
>     if (_threadingModel == threadingModel) return;
>
>     bool needSetUpThreading = _threadsRunning
>
>     if (_threadsRunning) stopThreading();
>
>     _threadingModel = threadingModel;
>
>     if (needSetUpThreading) setUpThreading();
> }
>
>
>
>
>
> If the current threading model is SingleThreaded then _threadsRunning will be false which means that needSetUpThreading will also be false. Therefore, setUpThreading() will never be called if we are in SingleThreaded.
>
> Rolling back the function to v3.4.0 seems to resolve the problem, but I'm not sure if that will cause other issues. There's obviously a reason why it was changed. I would like someone with more experience that I to way in. Below is a snipit of the rolled-back function.
>
>
> Code:
>
> void ViewerBase::setThreadingModel(ThreadingModel threadingModel)
> {
>     if (_threadingModel == threadingModel) return;
>
>     if (_threadsRunning) stopThreading();
>
>     _threadingModel = threadingModel;
>
>     if (isRealized() && _threadingModel!=SingleThreaded) startThreading();
> }
>
>
>
>
> Regards,
>
> Guy
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74324#74324
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list