]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: make windows Exit call runtime.exit
authorAlex Brainman <alex.brainman@gmail.com>
Thu, 8 Jun 2017 05:56:53 +0000 (15:56 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Thu, 8 Jun 2017 23:28:28 +0000 (23:28 +0000)
Both runtime.exit and syscall.Exit call Windows ExitProcess.
But recently (CL 34616) runtime.exit was changed to ignore
Windows CreateThread errors if ExitProcess is called.

This CL adjusts syscall.Exit to do the same.

Fixes #18253 (maybe)

Change-Id: I6496c31b01e7c7d73b69c0b2ae33ed7fbe06736b
Reviewed-on: https://go-review.googlesource.com/45115
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/syscall_windows.go
src/syscall/syscall_windows.go

index cd23b8da6b263303ad4615e6341126b0d21826a3..ca8ea8b04fd60a90102141f6ba127ed7733d9abe 100644 (file)
@@ -207,3 +207,9 @@ func syscall_Syscall15(fn, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
        cgocall(asmstdcallAddr, unsafe.Pointer(c))
        return c.r1, c.r2, c.err
 }
+
+//go:linkname syscall_exit syscall.Exit
+//go:nosplit
+func syscall_exit(code int) {
+       exit(int32(code))
+}
index 551a8c0dd3a4eecf01b4e390de4197e171f7c6a2..4619ce2a2bc6213f186b5673ce54bb6ba3479533 100644 (file)
@@ -236,7 +236,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
 
 // syscall interface implementation for other packages
 
-func Exit(code int) { ExitProcess(uint32(code)) }
+// Implemented in ../runtime/syscall_windows.go.
+func Exit(code int)
 
 func makeInheritSa() *SecurityAttributes {
        var sa SecurityAttributes