diff --git a/Sources/Concurrency/DispatchQueue/IDispatchQueue.swift b/Sources/Concurrency/DispatchQueue/IDispatchQueue.swift index 723bdb1..d9e9ecc 100644 --- a/Sources/Concurrency/DispatchQueue/IDispatchQueue.swift +++ b/Sources/Concurrency/DispatchQueue/IDispatchQueue.swift @@ -92,6 +92,18 @@ public protocol IDispatchQueue: AnyObject { /// /// - Parameter workItem: The work item to be invoked on the queue. func sync(execute workItem: DispatchWorkItem) + + /// + /// Submits a work item to a dispatch queue for asynchronous execution after + /// a specified time. + /// + /// - parameter: deadline the time after which the work item should be executed, + /// given as a `DispatchTime`. + /// - parameter execute: The work item to be invoked on the queue. + /// - SeeAlso: `asyncAfter(deadline:qos:flags:execute:)` + /// - SeeAlso: `DispatchTime` + /// + func asyncAfter(deadline: DispatchTime, execute: DispatchWorkItem) } public extension IDispatchQueue { diff --git a/Sources/TestConcurrency/TestDispatchQueue.swift b/Sources/TestConcurrency/TestDispatchQueue.swift index f29ed15..f72a2d6 100644 --- a/Sources/TestConcurrency/TestDispatchQueue.swift +++ b/Sources/TestConcurrency/TestDispatchQueue.swift @@ -47,4 +47,8 @@ extension TestDispatchQueue: IDispatchQueue { public func sync(execute workItem: DispatchWorkItem) { workItem.perform() } + + public func asyncAfter(deadline _: DispatchTime, execute: DispatchWorkItem) { + execute.perform() + } }