On 01/25/12 14:16, Richard Henderson wrote:
On 01/25/2012 01:30 PM, Patrick Marlier wrote:
 From my point of view, no. When it is a thread local, it should not
be shared to someone else. If the thread dies, what happens to the
thread local variable? Should it be discarded completely and this
piece of memory never reallocated? Even if the programmer take care
of this situation, does it make sense to share a thread local to
other threads?

No, Andi has a point.  It's no more invalid than sharing a variable
off the local stack with another thread.  All that's required is that
the foreign thread not keep the pointer permanently; that the use of
the tls variable end before the thread ends.

And it's entirely likely that I'd thought of exactly that two years
ago when the DECL_THREAD_LOCAL test was omitted from that bit of code,
but I failed to add a comment.

I guess this patch needs to be reverted...

Will do so.

Reply via email to