-
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
I noticed that the use of locks in the QueueManager, especially the one that throws, could end up holding onto the lock too long:
SwiftAudioEx/Sources/SwiftAudioEx/QueueManager.swift
Lines 20 to 32 in 4276703
| fileprivate func synchronizeThrows<T>(action: () throws -> T) throws -> T { | |
| recursiveLock.lock() | |
| let result = try action() | |
| recursiveLock.unlock() | |
| return result | |
| } | |
| fileprivate func synchronize <T>(action: () -> T) -> T { | |
| recursiveLock.lock() | |
| let result = action() | |
| recursiveLock.unlock() | |
| return result | |
| } |
defer block should guarantee that the lock is released on exiting. I haven't repro'd this, but I would think any failable function being passed to synchronizeThrows would cause later operations to hang.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels