mirror of
https://github.com/golang/go
synced 2024-11-19 16:44:43 -07:00
6af4e996e2
No need to acquire the M just to change G's paniconfault flag, and the original C implementation of SetPanicOnFault did not. The M acquisition logic is an artifact of golang.org/cl/131010044, which was started before golang.org/cl/123640043 (which introduced the current "getg" function) was submitted. Change-Id: I6d1939008660210be46904395cf5f5bbc2c8f754 Reviewed-on: https://go-review.googlesource.com/21935 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
23 lines
553 B
Go
23 lines
553 B
Go
// Copyright 2014 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package runtime
|
|
|
|
import _ "unsafe" // for go:linkname
|
|
|
|
//go:linkname setMaxStack runtime/debug.setMaxStack
|
|
func setMaxStack(in int) (out int) {
|
|
out = int(maxstacksize)
|
|
maxstacksize = uintptr(in)
|
|
return out
|
|
}
|
|
|
|
//go:linkname setPanicOnFault runtime/debug.setPanicOnFault
|
|
func setPanicOnFault(new bool) (old bool) {
|
|
_g_ := getg()
|
|
old = _g_.paniconfault
|
|
_g_.paniconfault = new
|
|
return old
|
|
}
|