-
Notifications
You must be signed in to change notification settings - Fork 6
Description
The when(fulfilled:…)
family takes a QoS and does all of its work there. The downside here is it can't resolve synchronously even if all inputs have resolved. By contrast, when(first:cancelRemaining:)
will resolve synchronously if any of the inputs have fulfilled/rejected.
Implementation note: One solution is to use .nowOr(_:)
(see #34) on the interior work. We can then test the group to see if it's ready synchronously. We could also rewrite the enqueue loop to only hop on the context if it's rejecting/cancelling, because writing to resultBuffer
can happen on any thread. Note that in this case we can still do the group.leave()
outside of the context, as the resultBuffer
entry will be nil
and thus our processing of the buffer will safely abort.