 				// the disposal would be delegated to the current sender, or
 				// occasionally one of the senders waiting on `sendLock`.
 				if let state = signal.state.swap(nil) {
-					// `terminationEvent` must be written before `terminationState`, or
-					// concurrent readers might not see the value of `terminationEvent`.
-					terminationEvent = event
-					terminationState = state
+					terminationState = SignalTerminationState(state: state,
+					                                          event: event)
 
 					// Writes to `terminationState` are implicitly synchronized. So we do
 					// not need to guard it with locks.

	}
}

private struct SignalState<Value, Error: Swift.Error> {
	var observers: Bag<Signal<Value, Error>.Observer> = Bag()
	var retaining: Signal<Value, Error>?
}


	public init(_ generator: (Observer) -> Disposable?) {
		state = Atomic(SignalState())

		/// Holds the final signal state captured by a termination event. If it
		/// is set, the Signal should terminate as soon as possible. Implicitly
		/// protected by `state` and `sendLock`.
		var terminationState: SignalTerminationState<Value, Error>? = nil

		/// Used to track if the signal has terminated. Protected by `sendLock`.
		var terminated = false
