diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-07-11 12:43:49 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-07-11 12:43:49 -0700 |
commit | 4854d721be78358e59367982bdd94461b4be3c5a (patch) | |
tree | 8ead189e618f8ef1456c8b02c81de0cc1585d8a6 /libgo/go/runtime/proc.go | |
parent | 3cdc95b9f8d6c90c4a279783fd3da961c5afb22c (diff) | |
parent | e109f6e438b72ef3e403162971068d28d09b82f5 (diff) | |
download | gcc-4854d721be78358e59367982bdd94461b4be3c5a.zip gcc-4854d721be78358e59367982bdd94461b4be3c5a.tar.gz gcc-4854d721be78358e59367982bdd94461b4be3c5a.tar.bz2 |
Merge from trunk revision e109f6e438b72ef3e403162971068d28d09b82f5
Diffstat (limited to 'libgo/go/runtime/proc.go')
-rw-r--r-- | libgo/go/runtime/proc.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 |