<div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 7, 2012 at 4:28 AM, Nuno Lopes <span dir="ltr"><<a href="mailto:nunoplopes@sapo.pt" target="_blank" class="cremed">nunoplopes@sapo.pt</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">Quoting Nick Lewycky <<a href="mailto:nicholas@mxc.ca" target="_blank" class="cremed">nicholas@mxc.ca</a>>:<br>

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nuno Lopes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- Please don't use function static variables. It's not good for thread<br>
safety.<br>
</blockquote>
<br>
Excuse me? On what platform are function local statics not thread safe? I've been known to advocate using function local statics as the solution to threading problems.<br>
</blockquote>
<br></div>
As far as I understand, the initialization of these variables is guaranteed to be thread safe by the standard, but not the access to them. That means that doing '++counter;' is not thread safe.</blockquote><div><br>
</div><div>Yea, sorry if i wasn't clear either, my comment only pertains to initialization.</div><div><br></div><div>C++11 added this requirement, GCC and Clang have for a long time emitted code according to this regardless of the standard requested, Older versions of MSVC definitely do not support it, and I don't know off hand which version added (or will add) support.</div>
</div></div>