Skip to content

Commit 85f41d5

Browse files
committed
Documentation proof-reading in Signal.
1 parent 06b731d commit 85f41d5

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Sources/Signal.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,30 @@ public final class Signal<Value, Error: Swift.Error> {
7373
//
7474
// Read directly.
7575
//
76-
// - Deliver `value` events in the `alive` state.
76+
// - Deliver `value` events with the alive state.
7777
//
7878
// `sendLock` must be acquired.
7979
//
80-
// - Replace the snapshot of a signal that is alive.
80+
// - Replace the alive state with another.
8181
// (e.g. observers bag manipulation)
8282
//
8383
// `updateLock` must be acquired.
8484
//
85-
// - Transition from `alive` to `terminating`.
85+
// - Transition from `alive` to `terminating` as a result of receiving
86+
// a termination event.
8687
//
87-
// `updateLock` must be acquired.
88+
// `updateLock` must be acquired, and should fail gracefully if the
89+
// signal has terminated.
8890
//
89-
// - Deliver the termination event in the `terminating` state, and
90-
// transition from `terminating` to `terminated`.
91+
// - Check if the signal is terminating, and transition from `terminating`
92+
// to `terminated` if it is. Deliver the termination event after the
93+
// transitioning.
9194
//
92-
// Both `sendLock` and `updateLock` must be acquired. The state must
93-
// also be checked again after the locks are acquired. Fail gracefully
94-
// if the state has changed since the relaxed read, i.e. a concurrent
95-
// sender has already handled the termination event.
95+
// Both `sendLock` and `updateLock` must be acquired. The check can be
96+
// relaxed, but the state must be checked again after the locks are
97+
// acquired. Fail gracefully if the state has changed since the relaxed
98+
// read, i.e. a concurrent sender has already handled the termination
99+
// event.
96100
//
97101
// Exploiting the relaxation of reads, please note that false positives
98102
// are intentionally allowed in the `terminating` checks below. As a

0 commit comments

Comments
 (0)