diff options
Diffstat (limited to 'src/runtime/signal_unix.go')
-rw-r--r-- | src/runtime/signal_unix.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index dbac55c3d1..c7a6c2197c 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -360,6 +360,13 @@ func preemptM(mp *m) { // required). return } + + // On Darwin, don't try to preempt threads during exec. + // Issue #41702. + if GOOS == "darwin" { + execLock.rlock() + } + if atomic.Cas(&mp.signalPending, 0, 1) { // If multiple threads are preempting the same M, it may send many // signals to the same M such that it hardly make progress, causing @@ -368,6 +375,10 @@ func preemptM(mp *m) { // Only send a signal if there isn't already one pending. signalM(mp, sigPreempt) } + + if GOOS == "darwin" { + execLock.runlock() + } } // sigFetchG fetches the value of G safely when running in a signal handler. |