Daniel Sperka wrote:
> [snip]
>
> 1) Am I required to use OpenSG Threads? If so, am I limited to just two?
>   
Nope & nope.

OpenSG uses some thread local data that need to be set in order to be 
able to dereference FCPtr's. Failure to do so will result in crashes in 
getAspect().

You need to call osg::ExternalThread::get(0)->initialize(0) from 
external threads that you want to make OpenSG calls in.

The 0 argument to initalize set's the aspect for that thread. If you 
manage locking yourself, you could use a single aspect for all of your 
threads. If not, you could use several aspects (default is two, one 
renders while the other mutates) and
> 2) If I limit the usage to FieldContainers to a single thread - i.e. all 
> FC's are created and used in that one thread, will that work? Even if I 
> use pthread_create? With a little more care I can easily segregate 
> OpenSG FC's to my "command thread".....
>   
Yup. Be sure to call osginit() from that thread.
> 3) The new website has a nice general discussion of threading in OpenSG. 
> It alludes to changes in OpenSG 2.0 - what is the status of those 
> changes? Were there improvements in OpenSG 1.8?
> 4) Can OpenSG be built as a single-threaded library? If so, will it buy 
> me anything (like reduced overhead, improved speed, etc)? My app will 
> remain multithreaded anyways..... just wondering.
>   
I don't think it's possible as such at the moment. It would by you some 
reduced overhead in space/time (at least w.r.t 1.8) but there's some 
ongoing work to fix it:

 1. In 2.0 FCPtrs might be abolished totally which reduces the time 
overhead on pointer access. (You'd have to map the pointer between 
threads though)
 2. Dynamic setting of number of aspects (before osginit). Setting it to 
1 will halve memory usage for most FieldContainers, compared to the 
current default of 2 aspects.

Someone from the core team ought to know more about the progress here...

Cheers,
/Marcus


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to