
22 Aug
2010
22 Aug
'10
10:59 a.m.
Le 22/08/2010 11:00, Kraus Philipp a écrit :
I have written my own random class, in which I use a static boost::mt19937. On a single thread always works fine, but on multithread I get race condition errors. So I would like to create a static member over all threads.
static data members are initialized before main. Your problem is not concurrent initialization, it's concurrent access to the same object. It has nothing to do whatsoever with only initializing a singleton once.