OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

ViewerBase::setThreadingModel() not working


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build]
View previous topic :: View next topic  
Author Message
guyv
Appreciator


Joined: 13 Feb 2009
Posts: 102

PostPosted: Thu Jul 12, 2018 3:22 pm    Post subject:
ViewerBase::setThreadingModel() not working
Reply with quote

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
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Jul 12, 2018 3:55 pm    Post subject:
ViewerBase::setThreadingModel() not working
Reply with quote

Hi Guy,

The commit that changes this was:

ommit bb84f1ea3c23625a645b9c2848202bca7c566efb
Author: Konstantin S. Matveyev <>
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 <> wrote:
Quote:

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
guyv
Appreciator


Joined: 13 Feb 2009
Posts: 102

PostPosted: Thu Jul 12, 2018 4:06 pm    Post subject:
Reply with quote

Hi,

I looked at the commit but the description does not clearly provide a reason for the change. I looked at the forum but could not find anything. I'll try the mailing list next.

Thank you!

Cheers,
Guy
Back to top
View user's profile Send private message
guyv
Appreciator


Joined: 13 Feb 2009
Posts: 102

PostPosted: Thu Jul 12, 2018 4:52 pm    Post subject:
Reply with quote

Hi,

I also looked at the osg-submissions archives and could not find any trace of this change. I went back as far as June 2017.
Back to top
View user's profile Send private message
guyv
Appreciator


Joined: 13 Feb 2009
Posts: 102

PostPosted: Thu Jul 12, 2018 5:22 pm    Post subject:
Reply with quote

Actually, if we want to adjust the threading affinity when cycling through the threading models then would it not be better to replace:

Code:
 
if (isRealized() && _threadingModel!=SingleThreaded) startThreading();


by

Code:
 
if (isRealized() && _threadingModel!=SingleThreaded) setUpThreading();


Guy
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Jul 12, 2018 5:26 pm    Post subject:
ViewerBase::setThreadingModel() not working
Reply with quote

On Thu, 12 Jul 2018 at 17:52, Guy Volckaert <> wrote:
Quote:
I also looked at the osg-submissions archives and could not find any trace of this change. I went back as far as June 2017.

Most submissions now come it via pull requests on github.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Mon Sep 03, 2018 11:45 am    Post subject:
ViewerBase::setThreadingModel() not working
Reply with quote

Hi Guy,

I have looked into the revision that Konstantin made back in January
and it looks to me like the intent was to prevent the viewer from
starting threads before you've called realize:

https://github.com/openscenegraph/OpenSceneGraph/commit/bb84f1ea3c23625a645b9c2848202bca7c566efb#diff-936c2b7991f9f45a3c10c4d64a053ac2

Your suggestion is a more robust way of doing this so Ive applied this
and it works for me:

https://github.com/openscenegraph/OpenSceneGraph/commit/ae3133522d18c1e456d22569137cdf45dac6b2f2

This change is merged with master and 3.6 branch.

Cheers,
Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts OSG vec3array size() function working... ak477 General 0 Fri Jul 06, 2018 5:57 pm View latest post
No new posts Viewer not working bakalarvae Build system [build] 4 Sun May 27, 2018 8:20 pm View latest post
No new posts Shader Program stops working after Ch... ceranco General 0 Mon May 21, 2018 3:09 pm View latest post
No new posts EXTERNAL: Re: EXTERNAL: Re: FBO setup... Rowley, Marlin R General 0 Thu May 10, 2018 12:56 pm View latest post
No new posts EXTERNAL: Re: FBO setup not working.. Rowley, Marlin R General 1 Thu May 10, 2018 12:49 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP