harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@apache.org>
Subject Re: [drlvm] thread local storage in open/hythread.h
Date Sun, 30 Mar 2008 21:41:07 GMT
On 29 марта 2008 Nathan Beyer wrote:
> In open/hythread.h there is the following bit of code.
> extern __thread hythread_t tm_self_tls;
> #else
> extern __declspec(thread) hythread_t tm_self_tls;
> hy_inline hythread_t VMCALL hythread_self() {
>     return tm_self_tls;
> }
> From what I know at the moment, the use of '__thread' isn't a POSIX
> standard, but rather a gcc extension and '__declspec(thread)' is a
> MSVC thing, so the check isn't quite correct. Neither of these works
> on MacOS X and from what I've been able to gather, it shouldn't work
> on FreeBSD, but I can't confirm that. In any case, I was looking at
> implementing this for MacOSX and FreeBSD using pthread_key_t. It seems
> like that could be used for other (all?) platforms as well. Any
> thoughts on that?

AFAIK there are plenty of different implementation for getting TLS in DRLVM's 
implementation of hythread. There are fast ways like those you've mentioned, 
slow ways using APR and pthread and very fast ways using inline assembly.

All of them are quite messed up right now and need some cleaning. The mess is 
with different defines that rule the whole stuff - it is not always clear 
which define set is used for a particular implementation on a given platform.


View raw message