On Sun, Dec 8, 2019 at 1:10 PM changkun <euryugas...@gmail.com> wrote:
>
> Thank you so much for your hint, I think I've figured it out.
> The root cause seems similar to the "uncertainty principle".
>
> As an observer, by adding a `println` call in `asyncPreempt`
> as well as `asyncPreempt2` influences the actual behavior
> after signal handling. The `println` involves stack split check,
> which calls the `morestack`.

Ah, of course.  One workaround is to use write, as in

// Package-scope variable
var myMsg = []byte("my message")

// In function.
    write(2, unsafe.Pointer(&myMsg[0]), int32(len(myMsg)))

This works because the various implementations of write are marked nosplit.

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/CAOyqgcVJ7oLCgLeXDUXdwZCbEroYRfE3Qo9FtcTJWwNSTccT-w%40mail.gmail.com.

Reply via email to