Skip to content

Commit c33ced6

Browse files
runtime: don't test sig.inuse in sigsend
Signals can be delivered on a different thread. There is no necessary happens-before relationship between setting sig.inuse in signal_enable and checking it in sigsend. It is theoretically possible, if unlikely, that sig.inuse is set by thread 1, thread 2 receives a signal, does not see that sig.inuse is set, and discards the signal. This could happen if the signal is received immediately after the first call to signal_enable. For #33174 Change-Id: Idb0f1c77847b7d4d418bd139e801c0c4460531d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/312131 Trust: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 190cb93 commit c33ced6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/sigqueue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const (
7272
// It runs from the signal handler, so it's limited in what it can do.
7373
func sigsend(s uint32) bool {
7474
bit := uint32(1) << uint(s&31)
75-
if !sig.inuse || s >= uint32(32*len(sig.wanted)) {
75+
if s >= uint32(32*len(sig.wanted)) {
7676
return false
7777
}
7878

0 commit comments

Comments
 (0)