diff options
Diffstat (limited to 'src/runtime/os_linux.go')
| -rw-r--r-- | src/runtime/os_linux.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index b1ddf53dd1..20b947f250 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -332,7 +332,9 @@ func gettid() uint32 func minit() { minitSignals() - // for debuggers, in case cgo created the thread + // Cgo-created threads and the bootstrap m are missing a + // procid. We need this for asynchronous preemption and its + // useful in debuggers. getg().m.procid = uint64(gettid()) } @@ -454,3 +456,11 @@ func sysSigaction(sig uint32, new, old *sigactiont) { // rt_sigaction is implemented in assembly. //go:noescape func rt_sigaction(sig uintptr, new, old *sigactiont, size uintptr) int32 + +func getpid() int +func tgkill(tgid, tid, sig int) + +// signalM sends a signal to mp. +func signalM(mp *m, sig int) { + tgkill(getpid(), int(mp.procid), sig) +} |
