
5 Sep
2011
5 Sep
'11
11:20 a.m.
On 05/09/2011 13:18, Mathias Gaunard wrote:
, so there could be data races for the previous_id in next_id() in multi threaded applications.
That's not namespace scope, that's function scope.
The C++11 standard (the only one aware of multithreading) mandates that initialization of static variables at function scope is thread-safe.
Sorry, that is irrelevant here, you'd need the full body of the function to be thread-safe if you need thread-safety even in code that happens before main.