http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54129

--- Comment #2 from blucia at gmail dot com 2012-07-30 20:25:52 UTC ---
The man page for pthread_key_create says:

"An optional destructor function may be associated with each key value.  ... 
The order of destructor calls is unspecified if more than one destructor exists
for a thread when it exits."

That's fine, but I did not register any destructor function for the __thread
variables that are getting zeroed!  In my program, only one destructor function
exists.  

It seems a little weird that those __thread variables are being zeroed at all. 
Again, I'm not sure what the spec says, but it seems like a better default
behavior would be to let them retain their values until termination, unless
explicitly altered elsewhere.  Doubly so, because it already does that on
Linux, and copying that behavior makes code more portable.

Reply via email to