]> Cypherpunks repositories - gostls13.git/commit
runtime: use _exit on darwin
authorCherry Zhang <cherryyz@google.com>
Thu, 12 Nov 2020 02:27:56 +0000 (21:27 -0500)
committerCherry Zhang <cherryyz@google.com>
Mon, 21 Dec 2020 19:16:38 +0000 (19:16 +0000)
commit8438a5779b76620237d608282a99d17467b91f4c
tree5e9821eefcd99c36548927e0c9f244553c3ee152
parentcb95819cf6e969dc7dcc64ec7820d3995379c9f4
runtime: use _exit on darwin

On darwin, where we use libc for syscalls, when the runtime exits,
it calls libc exit function, which may call back into user code,
e.g. invoking functions registered with atexit. In particular, it
may call back into Go. But at this point, the Go runtime is
already exiting, so this wouldn't work.

On non-libc platforms we use exit syscall directly, which doesn't
invoke any callbacks. Use _exit on darwin to achieve the same
behavior.

No test for now, as it doesn't pass on all platforms (see trybot
run of PS2).

May fix #42465.
May fix #43294.

Change-Id: Ia1ada22b5da8cb64fdd598d0541eb90e195367eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/269378
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/sys_darwin.go