Commit fa21ad5
committed
runtime: wake every waiter when stopping the signal watcher
The watcher is not the only thing that sleeps on signalFutex. sleepTicks waits
on it, and so does waitForEvents. Waking a single waiter could therefore wake a
sleeping goroutine instead of the watcher: that goroutine consumes the value
with its own Swap, and the watcher is left asleep on a futex that is 0 again,
never seeing the stop flag it was told to look at — which is the thread leak
this function exists to prevent.
WakeAll is what the signal handler already uses on this futex a few lines
below, for the same reason.1 parent e626202 commit fa21ad5
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
460 | 467 | | |
461 | | - | |
| 468 | + | |
462 | 469 | | |
463 | 470 | | |
464 | 471 | | |
| |||
0 commit comments