Remove unused NSE Task extension

This commit is contained in:
Stefan Ceriu
2025-04-17 13:55:47 +03:00
committed by Stefan Ceriu
parent f71e5facb8
commit 13186ea7c2
@@ -269,20 +269,3 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
case unsupportedShouldDiscard
}
}
// https://stackoverflow.com/a/77300959/730924
private extension Task where Failure == Error {
/// Performs an async task in a sync context.
///
/// - Note: This function blocks the thread until the given operation is finished. The caller is responsible for managing multithreading.
static func synchronous(priority: TaskPriority? = nil, operation: @escaping @Sendable () async throws -> Success) {
let semaphore = DispatchSemaphore(value: 0)
Task(priority: priority) {
defer { semaphore.signal() }
return try await operation()
}
semaphore.wait()
}
}