File tree Expand file tree Collapse file tree
Concurrency/DispatchQueue Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,6 +81,17 @@ public protocol IDispatchQueue: AnyObject {
8181 /// - SeeAlso: `async(execute:)`
8282 ///
8383 func sync( execute block: ( ) -> Void )
84+
85+ /// Schedules a work item for immediate execution, and returns immediately.
86+ ///
87+ /// - Parameter execute: The work item containing the task to execute.
88+ /// For information on how to create this work item.
89+ func async ( execute workItem: DispatchWorkItem )
90+
91+ /// Submits a block for synchronous execution on this queue.
92+ ///
93+ /// - Parameter workItem: The work item to be invoked on the queue.
94+ func sync( execute workItem: DispatchWorkItem )
8495}
8596
8697public extension IDispatchQueue {
Original file line number Diff line number Diff line change @@ -39,4 +39,12 @@ extension TestDispatchQueue: IDispatchQueue {
3939 public func async ( execute work: @escaping @convention ( block) ( ) -> Void ) {
4040 work ( )
4141 }
42+
43+ public func async ( execute workItem: DispatchWorkItem ) {
44+ workItem. perform ( )
45+ }
46+
47+ public func sync( execute workItem: DispatchWorkItem ) {
48+ workItem. perform ( )
49+ }
4250}
You can’t perform that action at this time.
0 commit comments