Hi Emmanuel,

The OSG does not support multi-threaded write at any time.

The OSG does support single threaded write, and multi-threaded read
only access where the single threaded write is done outside the
rendering traversals (the cull and draw).

With the advent of osgViewer we have a new threading model that
relaxes this constraint and uses double buffering of the rendering
backend data structures to facilitate threading of update and draw in
a parallel with draw, with the overlap between the two such that the
draw thread only releases the main thread once all the dynamic
drawable and stateset's have been drawn.  This threading model is
rather orthogonal to your needs though.

Visitors don't have any knowledge of mutexes in the scene graph so
will carry on regardless of any mutexes you have unless you explictly
use a visitor that checks them first.

Use of mutexes is very expensive so should only be used when
absolutely necessary - this is major reason for the approach the OSG
uses to multi-threading - its deliberately light weight and efficient.

Application level mutexes are fine as long as your not lock-unlock
thousands of times a second.

Robert.


On 4/5/07, Emmanuel Roche <[EMAIL PROTECTED]> wrote:
Hi there...

I think a lot of people are facing the same problem than me:

- My application is multithreaded
- I may use multiple 3D windows, with multiple "views", based on a single
OSG graph (multiple threads accessing the graph to draw)
- I have a script thread performing modifications on the graph

The only solution I figured out to prevent dead locks until now is to use a
BIG mutex to prevent script execution while drawing a frame in a window...
but, the performance are very low, so I really need to understand: What's
the best solution for multithread access to an OSG graph ???

by the way, aren't visitors supposed to be able to traverse the graph
without locking it before ??

regards,

Emmanuel.

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to