Hi Antoine, osgTerrain in 1.2 wasn't designed with threading in mind, so you're driving off road on this topic - there won't be able help directly in osgTerrain 1.2 for you.
Cancelling threads is best done co-operatively, so the code that is running in the thread you check to see if a "cancel" has been called. I say "cancel" as it might not be a thread type cancel, perhaps just a local flag that is checked every so often. You outside thread would set this cancel flag. The next question is how to get osgTerrain::DataSet to exit using the above stategy as there is not abort of cancel flag. The best you could do without modifying the code itself would be to subclass and override some of the main methods. Alternatively you could implement you own top level method that replace the current top level DataSet methods that you call, within these top level methods you add you own check. Modifying the source itself would be more straightforward though. Robert. On 5/16/07, Antoine Hue <[EMAIL PROTECTED]> wrote:
Hello, I cannot get out of a threading issue while using osgTerrain (OSG v1.2) in a separate worker thread. Context: - main thread rendering an OSG scene graph - 2nd thread running osgTerrain in batch mode on a separate graphic context. - everything runs fine if batch goes to completion. However, if I cancel the worker thread (e.g.: user interaction or application exiting before completion), I get an uncatchable exception with following call stack: #0 0x00002aaaad8d811d in raise () from /lib/libc.so.6 #1 0x00002aaaad8d984e in abort () from /lib/libc.so.6 #2 0x00002aaaad30dcc1 in unwind_cleanup () from /lib/libpthread.so.0 #3 0x00002aaaad4a72bd in std::ostream::flush () from /usr/lib/libstdc++.so.6 #4 0x00002aaaabb9d724 in osgUtil::Simplifier::simplify () from /home/tonio/local/lib64/libosgUtil.so #5 0x00002aaaab718d19 in osgTerrain::DataSet::DestinationTile::createPolygonal () from /home/tonio/local/lib64/libosgTerrain.so #6 0x00002aaaab71e58b in osgTerrain::DataSet::CompositeDestination::createPagedLODScene () from /home/tonio/local/lib64/libosgTerrain.so #7 0x00002aaaab71ee8f in osgTerrain::DataSet::CompositeDestination::createSubTileScene () from /home/tonio/local/lib64/libosgTerrain.so #8 0x00002aaaab71f02f in osgTerrain::DataSet::_writeRow () from /home/tonio/local/lib64/libosgTerrain.so #9 0x00002aaaab721cd7 in osgTerrain::DataSet::_buildDestination () from /home/tonio/local/lib64/libosgTerrain.so #10 0x00002aaaaac1802e in osgTerrain::DataSet::writeDestination (this=0x1056dd0) at DataSet:1203 #11 0x00002aaaaac1631c in pti::Map::processCore (this=0x1055bb0, state_=0x82ad80) at ../Map.cpp:289 #12 0x00002aaaaac194b4 in pti::ThreadProcessor::run (this=0x7f85b0) at ../MapProcessor.cpp:180 #13 0x00002aaaab33a370 in OpenThreads::ThreadPrivateActions::StartThread () from /home/tonio/local/lib/libOpenThreads.so I cannot get the ostream to flush properly or to exit as is. I tried to delete the osgTerrain::DataSet instance in thread's cancelCleanup but the exception is thrown before. Any idea ? Thread cancel is kind of difficult to handle. For example, I tried to perform a join after the cancel but this never returns... I use a thread condition to wait before exiting the main thread but this also not always complete on Mac OS X (at least). Thanks in advance for any help, Antoine _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
