From 4f79634bcd3283574e45429b23afbc942b0f6537 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 8 Feb 2007 22:36:16 +0000 Subject: [PATCH] =?UTF-8?q?From=20Andr=C3=A9=20Garneau,=20"Attached=20is?= =?UTF-8?q?=20a=20fix=20for=20the=20hang=20occuring=20on=20Win32=20when=20?= =?UTF-8?q?the=20thread=20model=20is=20changed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The issue was caused by the mutex in the ViewerDoubleBufferRenderingOperation being released even though they were not owned. This was causing the underlying critical section object lock count values becoming negative; the next time the lock was acquired it would block because of that." --- src/osgViewer/Viewer.cpp | 42 ++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 5eca20b25..d4773ac5b 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -228,6 +228,9 @@ struct ViewerDoubleBufferedRenderingOperation : public osg::Operation, public Vi _done(false), _databasePager(databasePager) { + _lockHeld[0] = false; + _lockHeld[1] = false; + _sceneView[0] = sv0; _sceneView[0]->getCullVisitor()->setDatabaseRequestHandler(_databasePager.get()); @@ -239,7 +242,11 @@ struct ViewerDoubleBufferedRenderingOperation : public osg::Operation, public Vi // lock the mutex for the current cull SceneView to // prevent the draw traversal from reading from it before the cull traversal has been completed. - if (!_graphicsThreadDoesCull) _mutex[_currentCull].lock(); + if (!_graphicsThreadDoesCull) + { + _mutex[_currentCull].lock(); + _lockHeld[_currentCull] = true; + } // osg::notify(osg::NOTICE)<<"constructed"< _sceneView[2]; int _frameNumber[2]; osg::observer_ptr _databasePager;