Skip to content

Commit 7a73f82

Browse files
committed
Improved the documentation in the event delivery routine.
1 parent 209d6c4 commit 7a73f82

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/Signal.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ public final class Signal<Value, Error: Swift.Error> {
134134
if !shouldDispose && !terminated && !isTerminating, let state = interruptedState {
135135
sendLock.lock()
136136

137+
// `terminated` before acquring the lock could be a false negative,
138+
// since it might race against other concurrent senders until the
139+
// lock acquisition above succeeds. So we have to check again if the
140+
// signal is really still alive.
137141
if !terminated {
138142
interrupt(state.observers)
139143
shouldDispose = true

0 commit comments

Comments
 (0)