When the port is started for the first time, a CountdownEvent is created with an initial count of 1.
1
On subsequent (re)starts, we'll dispose the current CountdownEvent and create a new one with initial count of 1.
private void InitializePendingChannelCountdown() { var original = Interlocked.Exchange(ref _pendingChannelCountdown, new CountdownEvent(1)); if (original != null) { original.Dispose(); } }