DnsUpdater/Sources/App/Util/Wait.swift

11 lines
217 B
Swift
Raw Permalink Normal View History

2024-11-15 10:46:29 +01:00
import Foundation
func wait(for block: @escaping @Sendable () async -> Void) {
let semaphore = DispatchSemaphore(value: 0)
Task {
await block()
semaphore.signal()
}
semaphore.wait()
}