Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,17 @@ final class CoreAIPipelinedEngine: InferenceEngine, Sendable {
}

func reset() {
drain()
// Cancel active generation BEFORE draining — otherwise drain() waits
// forever for a producer that will never release the engine.
_activeToken.withLock {
$0?.cancel()
$0 = nil
}
_generationTask.withLock { $0 = nil }
_generationTask.withLock {
$0?.cancel()
$0 = nil
}
drain()
guard tryAcquireEngine() else { return }
defer { releaseEngine() }
engine.reset()
Expand Down