From 2b6d99468d4d988fd5f5ea3e9be41a3dc95a1291 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 10 Jul 2020 10:51:40 -0700 Subject: libgo: update to Go 1.14.4 release Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/241999 --- libgo/go/runtime/proc.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libgo/go/runtime/proc.go') diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index f75cacf..e098137 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -1704,10 +1704,16 @@ func startTemplateThread() { if GOARCH == "wasm" { // no threads on wasm yet return } + + // Disable preemption to guarantee that the template thread will be + // created before a park once haveTemplateThread is set. + mp := acquirem() if !atomic.Cas(&newmHandoff.haveTemplateThread, 0, 1) { + releasem(mp) return } newm(templateThread, nil) + releasem(mp) } // templateThread is a thread in a known-good state that exists solely -- cgit v1.1