I thought C++0x allowed TLS class instances? Sent from my iPhone
On Jan 3, 2012, at 9:51 AM, "Martin Nowak" <[email protected]> wrote: > On Tue, 03 Jan 2012 18:44:27 +0100, Jacob Carlborg <[email protected]> wrote: > >> On 2012-01-03 17:53, Martin Nowak wrote: >>> Yes most, but not all. >>> The core issue here is that C++'s __thread doesn't allow dynamic >>> initializers, >>> thus there is no infrastructure to do such things. And really a clean >>> approach >>> would be to extend libc/ld.so. >> >> First, __thread isn't supported in Mac OS X (if we're talking about that). >> For all the operating systems that do support TLS I'm pretty sure that TLS >> and dynamic libraries work. >> >> This documentation: >> >> http://www.akkadia.org/drepper/tls.pdf >> >> mentions several different TLS modes, some used for dynamic libraries and >> some used for other cases. >> > > C++ takes a very simple approach here. > You can have > __thread int a = 3; > but not > __thread int a = geta(); > error: 'a' is thread-local and so cannot be dynamically initialized
