mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Remove unused NSE Task extension
This commit is contained in:
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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user