Memory management issues

This commit is contained in:
Ali
2023-09-21 00:12:53 +02:00
parent 5799d7a2d9
commit 62765b241d
123 changed files with 1291 additions and 1332 deletions

View File

@@ -64,10 +64,10 @@ public func suspendAwareDelay<T, E>(_ timeout: Double, granularity: Double = 4.0
startFinalTimer()
} else {
var invalidateImpl: (() -> Void)?
let timer = Timer(timeout: granularity, repeat: true, completion: {
let timer = Timer(timeout: granularity, repeat: true, completion: { timer in
let currentTimestamp = CFAbsoluteTimeGetCurrent()
if beginTimestamp + timeout - granularity * 1.1 <= currentTimestamp {
invalidateImpl?()
timer.invalidate()
startFinalTimer()
}
}, queue: queue)