diff options
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/cgocall.go | 5 | ||||
| -rw-r--r-- | src/runtime/proc1.go | 5 | ||||
| -rw-r--r-- | src/runtime/sigqueue.go | 9 |
3 files changed, 5 insertions, 14 deletions
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go index e7aeb7bee3..052830de5a 100644 --- a/src/runtime/cgocall.go +++ b/src/runtime/cgocall.go @@ -101,11 +101,6 @@ func cgocall_errno(fn, arg unsafe.Pointer) int32 { racereleasemerge(unsafe.Pointer(&racecgosync)) } - // Create an extra M for callbacks on threads not created by Go on first cgo call. - if needextram == 1 && cas(&needextram, 1, 0) { - systemstack(newextram) - } - /* * Lock g to m to ensure we stay on the same stack if we do a * cgo callback. Add entry to defer stack in case of panic. diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index 0ff3bafbdb..1c34e4b691 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -717,6 +717,11 @@ func mstart1() { // Install signal handlers; after minit so that minit can // prepare the thread to be able to handle the signals. if _g_.m == &m0 { + // Create an extra M for callbacks on threads not created by Go. + if needextram == 1 { + needextram = 0 + newextram() + } initsig() } diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go index df3c9c0e61..9cfe2592db 100644 --- a/src/runtime/sigqueue.go +++ b/src/runtime/sigqueue.go @@ -165,14 +165,5 @@ func signal_ignore(s uint32) { // This runs on a foreign stack, without an m or a g. No stack split. //go:nosplit func badsignal(sig uintptr) { - // Some external libraries, for example, OpenBLAS, create worker threads in - // a global constructor. If we're doing cpu profiling, and the SIGPROF signal - // comes to one of the foreign threads before we make our first cgo call, the - // call to cgocallback below will bring down the whole process. - // It's better to miss a few SIGPROF signals than to abort in this case. - // See http://golang.org/issue/9456. - if _SIGPROF != 0 && sig == _SIGPROF && needextram != 0 { - return - } cgocallback(unsafe.Pointer(funcPC(sigsend)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) } |
