Hello Georg, Georg Wünsch wrote: > Other topic: I am still on the way of trying to use OpenSG in a > multithreaded environment. > >>From my understanding, the classes use a so called thread aspect. Does that > have something to do with any of the native thread ids or how would I match > them against each other to tell both open sg and the other apps parts which > thread they are on?
aspects and threads are two different things, you associate a thread with an aspect so that it knows on which copy of the scenegraph data it should work. Every aspect holds a copy of every container in the system (contents of fields are shared until a beginEditCP() requires an unshare to keep the overhead low). When you create a thread you can associate it with an aspect (if you use some external library to create the thread you need to use the ExternalThread class to establish that association). > I am having several models that have to be calculating some simulation in > the background and manipulate open sg nodes and cores etc in one aspect, a > background threads aspect. right, those changes can be done in one aspect (say A1) as long as they don't touch the same containers concurrently. The rendering can keep running on a different aspect (A0) and is not affected by the changes until you apply the changes from the per thread (!) changelists to A0. > In the mean time the gui thread might be trying to draw the scene in another > aspect as I understand it. The aspects btw are numbered as 1 and 2, right?! no, they are numbered 0,1,... In OpenSG 1.x their number is a compile time constant that defaults to 2. > Every time I am switching the aspects something is crashing around a > beginEditCP or endEditCP. What might I be doing wrong? Any Clue? what do you mean by switching aspects? You should not be changing the aspect that a specific thread is associated with after it has done any work. Have you seen Doc/tutorial/progs/13multithreading2.cpp? The tutorial program is a highly simplified variant of something similar to what you are doing: Aspect 0 keeps rendering images while aspect 1 updates the scene. Cheers, Carsten ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users