Hello,
I have some problems when I add some multithreading functionality to a
project.
******************************************************************************************************
First I think I should describe the project a bit:
There is a library named "libcoll.so", which is used for the geometry
collision detections. It has an Interface "callback()" which can give back
the collision data to the user application. libcoll.so doesn't depend on the
opensg. It depends boost_thread for multithreading.
Then I write a test programm, named "movem". which uses libcoll for
collision detection and opensg for the rendering, in additionally it uses
boost_thread for multi-threading. the callback() function is programmed in
movem
callback::operator()
{
osg::xxxx();
}
so that the geometry and node can be changed after colision.
******************************************************************************************************
Now is my error:
By single-thread there is no error, but my multithreading, this means 2
threads, one is for collision detection and the other is the movem, the user
phase application.
Errors like this:
=========================================
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb4d9eb90 (LWP 18751)]
0xb72f7cd5 in osg::PThreadBase::getAspect () at
/home/weiyu/Projects/OpenSG/Source/System/FieldContainer/OSGThread.cpp:142
142 return *pUint;
=========================================
I imagine that, there are 2 probabilities for the errors?
1: the the opensg's function is called in the scope of callback(), which is
called by the thread collision detection not the movem, although it's
compiled and linked in movem. But collision detection library doesn't
recoginize the opensg, then error happens
2 the opensg's data types are thread-safe, this means all the data type like
osg::Node are protected by some mechanism like mutex or something else. when
the thread initialized by boost or direct by system accesses these data,
error happens.
I am not sure whether I am right, but When i comment the opensg code in
calback(), the programm works( 2 threads run correctly but no interactions )
If I am right, How can I resolve it?
Thanks
Weiyu
------------------------------------------------------------------------------
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