Hello, Robert
As you said, it is not safe to read for a data structure that is written to be
another thread. But if something wrong happens, the programme might tell
something when it is running. However in my case, the thread just stops at
somewhere during the implementation of IntersectionVisitor.apply(sceneNode).
In my programme, osg::Viewer works as a Otwidget of a QtApplication. A QtTimer
controls the frequency at which the Viewer calls frame(). The
intersectorVisitor is called to be accepted by the sceneNode(viewer) in
another thread. When I set the timer interval to be 0, the Viewer renders
normally, whereas the intersectionVIsitor stops at somewhere during the
implementation of IntersectionVisitor.apply(sceneNode) and the thread doesn't
go any further. So I thought , maybe it is because QTapplication controls the
data structure all the time. Then I change the timer interval to be 5000(i.e.5
second), and I thought, in this way, the data structure might not be controled
all the time by the QtApplication, which might lead to a chance for the thread.
However, the result turns out to be the same with that when timer interval is
0. The only difference is that the viewer renders in a much lower Frame rate.
I just don't know why the thread stops there. There is no mutual control like
Qtmutex in the traverse process of the sceneNode and the assistant functions of
Qt. So how it comes that intersectionVisitor stops functioning?
I use the bin library of OSG, so I cannot debug in OSG source code.
I am really confused.
Thank you for any hints on that.
Best regards and happy Easter day.
Shuiying
Message: 11
Date: Sun, 1 Apr 2012 18:44:28 +0100
From: Robert Osfieldrobert.osfi...@gmail.com
To: OpenSceneGraph Usersosg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Help: intersectionVisitor in a separate
working thread cannot work when it is to visit a view node
Message-ID:
cafn7y+xyjhv90c26hcrng9avdkh0gdujyuo9k6+oh+jjobj...@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1
Hi Shuiying,
It's not safe to read for a data structure that is written to be
another thread. If you scene graph is not changing then it'll be safe
to traverse multi-threaded without problem but if it's changing you'll
need to serialize the reading from the writing threads in some manner.
The normal frame loop that the OSG provides with the update and event
traversal that can do updates occurring single threaded and before the
cull and draw traversals start.
Robert.
On 1 April 2012 09:46, wang shuiyingshuiying.w...@fu-berlin.de wrote:
Hello,
In my programme, I have among others a view node and a thread. The
geometries under the view node changes every frame. The thread controls the
frequency at which an IntersectionVisitor visits the view node.
However it turns out it doesn't work. When the intersectionVisitor is ready
to visit the view node, it stops there, without going further.
If ?the visit of intersectionVisitor is made to be a part of ?the
updatecallback of view node, then it works.
I wonder if the intersectionVisitor can work separately from the
updatecallback of the node that it visits
Thank you very much in advance for any advice!
Shuiying
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org