Skip to content

Commit

Permalink
syscall: make windows Exit call runtime.exit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
Reviewed-by: Austin Clements <[email protected]>
  • Loading branch information
alexbrainman committed Jun 8, 2017
1 parent 78cf0e5 commit cfae35e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/runtime/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
3 changes: 2 additions & 1 deletion src/syscall/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfae35e

Please sign in to comment.