Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-10 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 11:58 PM Yonatan Gizachew wrote: > > Also, is there a way to print the values of runtime.g? In what sense? Code running the runtime package can just print it. Or if you run the program under gdb, you should be able to "print 'runtime.g'" (you need the quotes because

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-10 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 11:55 PM Yonatan Gizachew wrote: > > Thank you for the explanation. For example, please have a look at the this 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? If I recall

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-10 Thread Yonatan Gizachew
Also, is there a way to print the values of runtime.g? 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 wrote: > > > > This might be trivial, but could you explain me the relationship between > the following? > > 1.

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-10 Thread Yonatan Gizachew
Thank you for the explanation. For example, please have a look at the this 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

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 7:39 PM Yonatan Gizachew 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

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
This might be trivial, but could you explain me the relationship between the following? 1. value returned by __tls_get_addr 2. runtime.g 3. runtime.g0 4. runtime.mo 5. runtime.m Thanks:) On Thursday, September 10, 2020 at 11:31:21 AM UTC+9 Ian Lance Taylor wrote: > On Wed, Sep 9, 2020 at 7:26

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
I see. Thanks for the explanation. It basically use function interposition to redirect Pthreads function calls made from golang to Pth. In that case a thread runs until it reaches a pth yield instruction, which transfers control to the scheduler and activates another available thread. On

Re: [go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Ian Lance Taylor
On Wed, Sep 9, 2020 at 7:26 PM Yonatan Gizachew wrote: > > Is there any known problems that could appear when we run golang C-shared > libraries in an OS that uses a non-preemptive scheduling mechanism. I am > experiencing some problems related to TLS (more specifically runtime.m0 and >

[go-nuts] Running golang C-shared library in an OS that uses cooperative scheduling.

2020-09-09 Thread Yonatan Gizachew
Is there any known problems that could appear when we run golang C-shared libraries in an OS that uses a non-preemptive scheduling mechanism. I am experiencing some problems related to TLS (more specifically runtime.m0 and runtime.g0). FYI - the C-shared library was built suing the gccgo