Skip to content

Commit

Permalink
Improved the documentation in the event delivery routine.
Browse files Browse the repository at this point in the history
  • Loading branch information
andersio committed Nov 27, 2016
1 parent 209d6c4 commit 7a73f82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public final class Signal<Value, Error: Swift.Error> {
if !shouldDispose && !terminated && !isTerminating, let state = interruptedState {
sendLock.lock()

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

0 comments on commit 7a73f82

Please sign in to comment.