mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "runtime/cgo: store M for C-created thread in pthread key"
This reverts CL 485500. Reason for revert: This breaks internal tests at Google, see b/280861579 and b/280820455. Change-Id: I426278d400f7611170918fc07c524cb059b9cc55 Reviewed-on: https://go-review.googlesource.com/c/go/+/492995 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Chressie Himpel <chressie@google.com>
This commit is contained in:
parent
f379e78951
commit
72c33a5ef0
46 changed files with 67 additions and 1012 deletions
|
|
@ -435,7 +435,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
|
|||
c := &sigctxt{info, ctx}
|
||||
gp := sigFetchG(c)
|
||||
setg(gp)
|
||||
if gp == nil || (gp.m != nil && gp.m.isExtraInC) {
|
||||
if gp == nil {
|
||||
if sig == _SIGPROF {
|
||||
// Some platforms (Linux) have per-thread timers, which we use in
|
||||
// combination with the process-wide timer. Avoid double-counting.
|
||||
|
|
@ -458,18 +458,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
|
|||
return
|
||||
}
|
||||
c.fixsigcode(sig)
|
||||
// Set g to nil here and badsignal will use g0 by needm.
|
||||
// TODO: reuse the current m here by using the gsignal and adjustSignalStack,
|
||||
// since the current g maybe a normal goroutine and actually running on the signal stack,
|
||||
// it may hit stack split that is not expected here.
|
||||
if gp != nil {
|
||||
setg(nil)
|
||||
}
|
||||
badsignal(uintptr(sig), c)
|
||||
// Restore g
|
||||
if gp != nil {
|
||||
setg(gp)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -585,7 +574,7 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool {
|
|||
|
||||
// sp is not within gsignal stack, g0 stack, or sigaltstack. Bad.
|
||||
setg(nil)
|
||||
needm(true)
|
||||
needm()
|
||||
if st.ss_flags&_SS_DISABLE != 0 {
|
||||
noSignalStack(sig)
|
||||
} else {
|
||||
|
|
@ -1058,7 +1047,7 @@ func badsignal(sig uintptr, c *sigctxt) {
|
|||
exit(2)
|
||||
*(*uintptr)(unsafe.Pointer(uintptr(123))) = 2
|
||||
}
|
||||
needm(true)
|
||||
needm()
|
||||
if !sigsend(uint32(sig)) {
|
||||
// A foreign thread received the signal sig, and the
|
||||
// Go code does not want to handle it.
|
||||
|
|
@ -1126,9 +1115,8 @@ func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
|
|||
// (1) we weren't in VDSO page,
|
||||
// (2) we were in a goroutine (i.e., m.curg != nil), and
|
||||
// (3) we weren't in CGO.
|
||||
// (4) we weren't in dropped extra m.
|
||||
gp := sigFetchG(c)
|
||||
if gp != nil && gp.m != nil && gp.m.curg != nil && !gp.m.isExtraInC && !gp.m.incgo {
|
||||
if gp != nil && gp.m != nil && gp.m.curg != nil && !gp.m.incgo {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue