Thank you for the explanation. For example, please have a look at the this 
<https://github.com/Emegua/golang_nuts/blob/master/__tls_get_addr_> bt. 
__tls_get_addr is called after runtime.getg. So, what does __tls_get_addr 
return at this time, a pointer to runtime.g or runtime.g itself? 


On Thursday, September 10, 2020 at 12:15:04 PM UTC+9 Ian Lance Taylor wrote:

> On Wed, Sep 9, 2020 at 7:39 PM Yonatan Gizachew <eme...@gmail.com> wrote:
> >
> > This might be trivial, but could you explain me the relationship between 
> the following?
> > 1. value returned by __tls_get_addr
>
> This is the address of the TLS control block. The exact definition
> depends on the architecture. All TLS variables are at some offset
> from this value.
>
> > 2. runtime.g
>
> A TLS variable that holds the current goroutine, a pointer to a g struct.
>
> > 3. runtime.g0
>
> A global variable that holds the g struct used for the initial goroutine.
>
> > 4. runtime.m0
>
> A global variable that holds the m struct used for the initial thread.
>
> > 5. runtime.m
>
> gccgo no longer uses this. In earlier releases it was a TLS variable
> that holds the current thread, a pointer to an m struct. In current
> releases gccgo uses g->m for this.
>
> Ian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20dd490b-f972-4af7-bf4c-f2ab8188c5c1n%40googlegroups.com.

Reply via email to