Re: [go-nuts] asmcgocall and async preemption

2020-03-29 Thread Laevus Dexter
I see, thank you.

-- 
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/1dc631bb-0bcd-47b5-b219-e83d961e40dc%40googlegroups.com.


Re: [go-nuts] asmcgocall and async preemption

2020-03-29 Thread Ian Lance Taylor
On Sun, Mar 29, 2020 at 9:42 AM Laevus Dexter  wrote:
>
> Go 1.14 has introduced new async preemption stuff.
> I'm wondering what would happen if you were inside C code and preemption 
> signal has arrived? How can I reproduce this case to test stuff like this: 
> https://github.com/LaevusDexter/asmcgocall ?

If a thread is running C code when a preemption signal arrives, the
signal handler will observe that fact and take no action.

It looks like the asmcgocall package calls runtime.asmcgocall
directly.  That is completely unsupported and you should expect that
to break in various unpredictable ways, and you should not expect
consistent behavior across Go releases.  In general, though, I
wouldn't expect signal preemption to introduce additional problems.
When the signal arrives while executing C code, the signal handler
will see that it has no idea what function the PC is in, and it will
take no action.

It should be easy enough to test this by calling a C function that
just goes to sleep.  It will eventually receive a preemption signal.

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/CAOyqgcX%2BSO6M0a%3DXqXnP5O-LLRQDpntB0SP4kS3K%3DPvFdnhOsQ%40mail.gmail.com.