Hi,
In my programm, one thread is used to detect the collisions and call the
callbacks if collisions happen, and the main thread is used to controll the
scene and render it with OpenSG. I exploit boost::thread for the
multirheading mechanism
but now I have some problems:
1) When I use the multithreading mechanism by mutex, which is provided by
boost. Callback for collision detection thread and main thread may change
the scene at the same time, so I have the mutex them. but while renderring
the scene, it runs sometimes very slowly, the redraw() function sometimes
takes the 10x more time
than normal, Why should it happen? Principle it has only read access to
the scene daten and in my code mutex has no affect to it:
******************************
Func Time(microsec)
main::redraw(): 3663
main::redraw(): 10232
main::redraw(): 1572
main::redraw(): 1497
main::redraw(): 1511
main::redraw(): 1408
main::redraw(): 45564
main::redraw(): 1622
main::redraw(): 1509
main::redraw(): 1439
main::redraw(): 1508
main::redraw(): 43036
main::redraw(): 1769
main::redraw(): 7248
main::redraw(): 1757
main::redraw(): 1492
main::redraw(): 1574
main::redraw(): 2367
main::redraw(): 1629
main::redraw(): 13290
******************************
2) I add the code like:
OSG::UInt32 aspectId = 0;
OSG::ExternalThread::get(0)->initialize(aspectId);
with a callback in the collision detection thread
Could I use the multithreading mechanism of OpenSG when I have declared the
external thread to OpenSG? e.g like: aspectID=1. and some necessary
function like getChangeList()->applyAndClear() ?
With best regards
Weiyu
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users