v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop
This commit is contained in:
@@ -76,8 +76,8 @@ struct AutoFreeOnDoneTests {
|
||||
/// Drive engine.processBlock in tight bursts so engine-time runs many
|
||||
/// multiples of wall-time. Same pattern as `LyrebirdEventListTests`.
|
||||
private final class TestBlockDriver: @unchecked Sendable {
|
||||
private var _thread: Thread?
|
||||
private let _running: Atomic<Bool> = Atomic<Bool>(false)
|
||||
private let _done: DispatchSemaphore = DispatchSemaphore(value: 0)
|
||||
private let _engine: SynthesisEngine
|
||||
private static let blocksPerBurst: Int = 32
|
||||
private static let wallSleepSeconds: TimeInterval = 0.001
|
||||
@@ -91,12 +91,17 @@ struct AutoFreeOnDoneTests {
|
||||
}
|
||||
Thread.sleep(forTimeInterval: Self.wallSleepSeconds)
|
||||
}
|
||||
self._done.signal()
|
||||
}
|
||||
thread.qualityOfService = .userInteractive
|
||||
thread.start()
|
||||
_thread = thread
|
||||
}
|
||||
func stop() { _running.store(false, ordering: .relaxed) }
|
||||
/// Stop and **join** the pump thread so no `processBlock` runs after
|
||||
/// `stop()` returns to race the engine's own `stop()`. Idempotent.
|
||||
func stop() {
|
||||
guard _running.exchange(false, ordering: .relaxed) else { return }
|
||||
_done.wait()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Tests
|
||||
|
||||
Reference in New Issue
Block a user