|
You know, I keep coming back to the done flag. It isn't volatile and I
don't see the mechanism that keeps the value synchronized between
threads. I know there has to be something that does it, because nobody
else is seeing thread related shut down problems. Perhaps that's my first problem: assuming that it is ok to call viewer->setDone() from a different thread? Cory Robert Osfield wrote: Hi Cory, Could you modify one of the OSG examples to reproduce the problem you are seeing so that others can have a bash at reproducing the problem as trying to debug this type of stuff remotely is next to impossible.Robert. On Tue, Jun 23, 2009 at 10:45 PM, Cory Riddell<[email protected]> wrote:Robert et al, So, the 2.9.5 build doesn't fix my problem. My app has two threads. The second one is my viewer thread. To shutdown, my main threads calls viewer->setDone(true) then waits on a shared lock. The viewer thread stops running (I start the viewer with viewer->run()) and then calls viewer->stopThreading() and verifies that getAllThreads(threads,true) returns 0. It then notifies the main thread and exits. I really don't understand why getAllThreads() would return 0 when GraphicsContext::runOperations() still seems to be running. This is why I was asking about the done flag being reset to true (you told me it was reinitializing) and about the non-volatile-ness of the done flags. I'm no multithreading guru, but this isn't my first multithreaded app either. I'm confused. Cory Cory Riddell wrote: Hi Robert, I just saw your post about the release of 2.9.5 and it includes threading fixes. I think I'll grab that and give it a go before I bother the list about this any more. Thanks, Cory Robert Osfield wrote: Hi Cory, Do you find that normal OSG apps have problems when shutting down? Which version of the OSG are you using? When you say delete, exactly how are you going about delete? Could you supply an example of the clean up code you are using, it does sound like there is something amiss. Robert. On Mon, Jun 22, 2009 at 4:19 PM, Cory Riddell<[email protected]> wrote: Hi Robert, The reason I started to look at this flag is because I'm getting frequent access violations when shutting down my app. Usually, the problem is in GraphicsContext::runOperations(). When I shut down, I call setDone(true) on my viewer instance. I also call stopThreading() and make sure that getAllThreads(threads, true) returns 0, then I delete everything. I thought this would be sufficient, but I'm still getting an access violation in GraphicsContext::runOperations() when it tries to dereference a camera pointer and the camera has been deleted. My scene includes two cameras, the primary one and a second one to render the background. Is there some other indicator that OSG threads are still running that I should be waiting on? Cory Robert Osfield wrote: HI Cory, The Done flag is a hint to say tell threads that work should stop, so once it's stopped you want to reset things so that we you start the threads again it doesn't think that it's done again. Robert. On Mon, Jun 15, 2009 at 9:37 PM, Cory Riddell<[email protected]> wrote: ViewerBase::stopThreading() includes this block of code: for(Cameras::iterator camItr = cameras.begin(); camItr != cameras.end(); ++camItr) { osg::Camera* camera = *camItr; Renderer* renderer = dynamic_cast<Renderer*>(camera->getRenderer()); if (renderer) { renderer->setGraphicsThreadDoesCull( true ); renderer->setDone(false); } } Since threading is being stopped, shouldn't the line in red be setting done to true? Cory _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ________________________________ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org |
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

