From: Kevin Yuan (farproc_at_[hidden])
Date: 2007-04-05 10:40:17
2007/4/5, Jeff Garland <jeff_at_[hidden]>:
> Yeah sure, classic Meyer's singleton. Couple problems. It's not thread safe
It may be not thread safe. If it is first called in the "single thread
initialization phase"(or a term like that) there wil be no thread
safty problem, but no "lazy instantiation" as well.
> and you could easily inline this code into multiple translation units.
I don't agree. Compiler should not make multiple instances of a
<b>static local</b> variable,
> In both cases you might wind up with multiple copies of your singleton in the
> process. It's this sort of thing that makes true singletons devilishly hard
> to do...