<div dir="ltr">A few lines above that comment says:<div><br></div><div><div>  // Note that this would not normally be thread safe. However,</div><div>  // VTK initializes static objects at load time, which in turn call</div>

<div>  // this functions, which make this thread safe. If this behavior</div><div>  // changes, this should also be fixed by converting it to a static</div><div>  // class member which is initialized at load time.</div></div>

<div><br></div><div style>That code gets called for the first time at library load time, which by definition would have to be done in a single thread. I would normally move it directly into library load time by using a static but then I run into initialization order issues. Actually, I realized that I can guarantee that it would get called at library load time. A fix coming shortly.</div>

<div style><br></div><div style>-berk</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 1:29 PM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 08/26/2013 12:05 PM, Berk Geveci wrote:<br>
> Can you try this?<br>
<br>
</div>From the patch:<br>
<br>
+  if (!vtkTimeStamp::GlobalTimeStamp)<br>
+    {<br>
+#if VTK_SIZEOF_VOID_P == 8<br>
+    vtkTimeStamp::GlobalTimeStamp = new vtkAtomicInt64;<br>
<br>
This runtime initialization is not thread-safe, which IIUC<br>
is the entire point of using an atomic integer.  We can<br>
achieve proper static initialization and finalization using<br>
the same Schwarz Counter idiom:<br>
<br>
 <a href="http://en.wikibooks.org/wiki/More_C++_Idioms/Nifty_Counter" target="_blank">http://en.wikibooks.org/wiki/More_C++_Idioms/Nifty_Counter</a><br>
<br>
that we already use in several places.  It provides a way<br>
to order things across translation units.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Brad<br>
</font></span></blockquote></div><br></div>