From 7a73f824e4d4a8830e5095bd388b21c631c60c40 Mon Sep 17 00:00:00 2001 From: Anders Date: Sun, 27 Nov 2016 18:38:15 +0100 Subject: [PATCH] Improved the documentation in the event delivery routine. --- Sources/Signal.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Signal.swift b/Sources/Signal.swift index f5b5722dc..08b9a33e8 100644 --- a/Sources/Signal.swift +++ b/Sources/Signal.swift @@ -134,6 +134,10 @@ public final class Signal { 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