summaryrefslogtreecommitdiffhomepage
path: root/ios/Operations
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2023-01-12 12:48:18 +0100
committerAndrej Mihajlov <and@mullvad.net>2023-01-17 10:38:30 +0100
commit64e254bad6becaf30cd53ec24fb9984942b9bcfa (patch)
tree6507caa21f74a386b5319dd81fdfea072aed4f0a /ios/Operations
parentf9defadab69084965dcc9c4f9fd194dde250cce4 (diff)
downloadmullvadvpn-64e254bad6becaf30cd53ec24fb9984942b9bcfa.tar.xz
mullvadvpn-64e254bad6becaf30cd53ec24fb9984942b9bcfa.zip
Add helper to create serial operation queue
Diffstat (limited to 'ios/Operations')
-rw-r--r--ios/Operations/AsyncOperationQueue.swift8
1 files changed, 7 insertions, 1 deletions
diff --git a/ios/Operations/AsyncOperationQueue.swift b/ios/Operations/AsyncOperationQueue.swift
index f454340a45..4579546084 100644
--- a/ios/Operations/AsyncOperationQueue.swift
+++ b/ios/Operations/AsyncOperationQueue.swift
@@ -8,7 +8,7 @@
import Foundation
-public class AsyncOperationQueue: OperationQueue {
+public final class AsyncOperationQueue: OperationQueue {
override public func addOperation(_ operation: Operation) {
if let operation = operation as? AsyncOperation {
let categories = operation.conditions
@@ -42,6 +42,12 @@ public class AsyncOperationQueue: OperationQueue {
}
}
}
+
+ public static func makeSerial() -> AsyncOperationQueue {
+ let queue = AsyncOperationQueue()
+ queue.maxConcurrentOperationCount = 1
+ return queue
+ }
}
private final class ExclusivityManager {