This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: externs and thread local storage


On 7/2/06, Gary Funck <gary@intrepid.com> wrote:
...
More to the point, I think it is rather too bad that the
extern has to have the __thread attribute at all, and would
have hoped that the linker and OS could have collaborted to
make this transparent, in the same way that data can arranged
in separately linked sections without impacting the way
the external references are written.  Thus, implementation
is separated from interface.

TLS variable and non-TLS variable have totally different behaviors, and hence they are not interchangeable. Therefore, TLS aspect should not be made "transparent" i.e. The programmer has to treat a global variable differently depending on whether or not it is a TLS and getting a different one when you expected otherwise will cause subtle (well, actually not so suble, since it's likely to blow up in your face) runtime problems.

 I think the requirement to apply
_thread to an extern should also be target specific.

As I said, you're welcome to implement a new option (either a runtime option or a compile time configuration option) that will allow mixing TLS vs non-TLS. Whether or not it should be enabled for a particular platform should be a matter of discussion, and whether or not that patch will be accepted in the mainline will be yet another.

Because of the reasons I said above, I think it's a bad idea in general
and I'll oppose to it for any of platforms I care about.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]