4 ms·
Unfortunately, the space overhead is not quite that insignificant. It requires at least one bit of storage per thread; this does not matter much for a singleton
by rbehrends 13y ago
Unfortunately, the space overhead is not quite that insignificant. It requires at least one bit of storage per thread; this does not matter much for a singleton class, but if you want to implement more general write-once data structures (such as arrays or hash tables), it's not negligible.
Somewhat less problematic is that fast TLS is not natively available on all architectures (in particular, Mac OS X). Luckily, this can be worked around relatively easily.
- WalterBright 13y agoD does its own TLS implementation on OS X. But now that newer versions of OS X have native TLS, we'll be scrapping ours and using the native one.