Fixes #15061.
Change-Id: I71f69f398d1c5f3a884bbd044786f1a5600d0fae
Reviewed-on: https://go-review.googlesource.com/21398
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
mp.ncgo++
defer endcgo(mp)
- // Allocate memory to hold a cgo traceback if the cgo call crashes.
- if mp.cgoCallers == nil {
- mp.cgoCallers = new(cgoCallers)
- }
-
// Reset traceback.
mp.cgoCallers[0] = 0
// so we need to publish it safely.
atomicstorep(unsafe.Pointer(&allm), unsafe.Pointer(mp))
unlock(&sched.lock)
+
+ // Allocate memory to hold a cgo traceback if the cgo call crashes.
+ if iscgo || GOOS == "solaris" || GOOS == "windows" {
+ mp.cgoCallers = new(cgoCallers)
+ }
}
// Mark gp ready to run.