Hi,

On Wed, 2009-10-21 at 14:11 -0500, Carsten Neumann wrote:
>       Hello Gabriel,
> 
> Gabriel Zachmann wrote:
> > Is it possible to access OpenSG data structures (via OpenSG method 
> > calls) from threads that were not created as OpenSG threads?
> 
> yes, but OpenSG needs to be told about the thread so it knows which 
> aspect the thread should modify, see below how to do that.
> 
> > Right now, I've got a program with a non-OpenSG thread that makes the 
> > program crash, whenever it tries to execute an OpenSG function.
> > Gdb shows that it crashes here:
> > 
> >> 0xb72f7cd5 in osg::PThreadBase::getAspect () at 
> >> /home/weiyu/Projects/OpenSG/Source/System/FieldContainer/OSGThread.cpp:142 
> >>
> > All insights will be highly appreciated!
> 
> this is probably the same problem Weiyu just asked about ;)
> To register an external thread with OpenSG put the following at the top 
> of the thread fucntion:
> 
> OSG::UInt32 aspectId = 0;
> OSG::ExternalThread::get(0)->initialize(aspectId);
> 

in addition for 2.x there already is a compile option,
OSG_ENABLE_AUTOINIT_THREADS, which adds code to auto init the thread
structures on demand. Off by default.

I'm currently looking into shifting this back into 1.x as some 
people have problems with the java garbage collector when using
java bindings as it seem to run arbitrary threads to clean up things.

kind regards,
  gerrit




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to