I'll have a crack at it, unless someone else is already doing it. I've got an environment here that exercises the issue consistently. Anthony
________________________________ From: Robert Osfield [mailto:robert.osfi...@gmail.com] Sent: Tuesday, 17 March 2009 8:22 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Multithreading crashduetoosgDb::Registry::instance() HI Richard + Paul, Thanks for explanation. Feel free to dive in an code up such a solution. Robert. On Tue, Mar 17, 2009 at 10:17 AM, Schmidt, Richard <richard.schm...@eads.com> wrote: The document is about a design pattern called double locking, which is especially suitable for singleton objects in multithreaded environments. The pattern is essentially this: static Singleton *instance (void) { // First check if (instance_ == 0) { // Ensure serialization (guard // constructor acquires lock_). Guard<Mutex> guard (lock_); // Double check. if (instance_ == 0) instance_ = new Singleton; } return instance_; // guard destructor releases lock_. } The guard mutex is only accessed in the initialization phase of the singleton. Once instance_ is set the guard does not need to be queried anymore. Richard _______________________________________ Von: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] Im Auftrag von Robert Osfield Gesendet: Dienstag, 17. März 2009 11:07 An: OpenSceneGraph Users Betreff: Re: [osg-users] Multithreading crash duetoosgDb::Registry::instance() 2009/3/17 Schmidt, Richard <richard.schm...@eads.com> http://www.cs.wustl.edu/~schmidt/PDF/DC-Locking.pdf <http://www.cs.wustl.edu/%7Eschmidt/PDF/DC-Locking.pdf> Could you explain what the above document is all about... Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org