Add fast path for queue.async(flags: .barrier)
Replicate which fixes
from the Darwin overlay to the wrapping overlay.
@@ -181,10 +181,15 @@ public extension DispatchQueue {
flags: DispatchWorkItemFlags = [],
execute work: @escaping @convention(block) () -> Void)
{
- if group == nil && qos == .unspecified && flags.isEmpty {
+ if group == nil && qos == .unspecified {
// Fast-path route for the most common API usage
+ if flags.isEmpty {
CDispatch.dispatch_async(self.__wrapped, work)
return
+ } else if flags == .barrier {
+ CDispatch.dispatch_barrier_async(self.__wrapped, work)
+ return
+ }
}
var block: @convention(block) () -> Void = work
