<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=382503903-18032009><FONT face=Arial
color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=382503903-18032009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=382503903-18032009><FONT face=Arial
color=#0000ff size=2>Anthony</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Robert Osfield
[mailto:robert.osfield@gmail.com] <BR><B>Sent:</B> Tuesday, 17 March 2009 8:22
PM<BR><B>To:</B> OpenSceneGraph Users<BR><B>Subject:</B> Re: [osg-users]
Multithreading crashduetoosgDb::Registry::instance()<BR></FONT><BR></DIV>
<DIV></DIV>HI Richard + Paul,<BR><BR>Thanks for explanation. Feel free
to dive in an code up such a solution.<BR><BR>Robert.<BR><BR>
<DIV class=gmail_quote>On Tue, Mar 17, 2009 at 10:17 AM, Schmidt, Richard
<SPAN dir=ltr><<A
href="mailto:Richard.Schmidt@eads.com">Richard.Schmidt@eads.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">The
document is about a design pattern called double locking, which is
especially suitable for singleton objects in multithreaded
environments.<BR><BR>The pattern is essentially this:<BR>
<DIV class=im><BR>static Singleton *instance (void)<BR>{<BR>// First
check<BR>if (instance_ == 0)<BR>{<BR>// Ensure serialization (guard<BR>//
constructor acquires lock_).<BR>Guard<Mutex> guard (lock_);<BR>//
Double check.<BR>if (instance_ == 0)<BR>instance_ = new
Singleton;<BR>}<BR>return instance_;<BR>// guard destructor releases
lock_.<BR>}<BR><BR></DIV>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.<BR>
<DIV class=im><BR>Richard<BR>_______________________________________<BR>Von:
<A
href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</A>
[mailto:<A
href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</A>]
Im Auftrag von Robert Osfield<BR></DIV>Gesendet: Dienstag, 17. März 2009
11:07<BR>
<DIV class=im>An: OpenSceneGraph Users<BR>Betreff: Re: [osg-users]
Multithreading crash duetoosgDb::Registry::instance()<BR><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>2009/3/17 Schmidt, Richard <<A
href="mailto:Richard.Schmidt@eads.com">Richard.Schmidt@eads.com</A>><BR><A
href="http://www.cs.wustl.edu/%7Eschmidt/PDF/DC-Locking.pdf"
target=_blank>http://www.cs.wustl.edu/~schmidt/PDF/DC-Locking.pdf</A><BR><BR>Could
you explain what the above document is all
about...<BR><BR>Robert.<BR></DIV></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>_______________________________________________<BR>osg-users
mailing list<BR><A
href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</A><BR><A
href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org"
target=_blank>http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>