From b216007f0ad042b86afa9e031f9fefb6033c93f5 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 17 Nov 2026 07:17:05 -0800 Subject: [PATCH] metal2vulkan-rt: quiesce's doc states the exit contract The consumer quiesces before exit(); an atexit handler holds only where registered after the driver loaded (after Device::new), as the README now says. Verified: cargo fmt; the lint job follows. --- crates/metal2vulkan-rt/src/device.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/metal2vulkan-rt/src/device.rs b/crates/metal2vulkan-rt/src/device.rs index 00402f973..cea4fd41a 100644 --- a/crates/metal2vulkan-rt/src/device.rs +++ b/crates/metal2vulkan-rt/src/device.rs @@ -394,10 +394,12 @@ impl Device { /// that need a runtime thread return [`Error::Quiesced`]: taking a block, a command buffer, /// an enqueue or commit, a zeroed Private buffer, and a listener. /// - /// Safe in an `atexit` handler on whichever thread calls `exit()`: it joins a thread only once - /// that thread has ended, reads no thread-local that `exit()` tears down, and takes no lock a - /// consumer's thread can hold. A second call returns at once, with the first call's answer, - /// or false while the first is still running. + /// The consumer calls it before `exit()`. It can also run in an `atexit` handler on whichever + /// thread calls `exit()`: it joins a thread only once that thread has ended, reads no + /// thread-local that `exit()` tears down, and takes no lock a consumer's thread can hold. Such + /// a handler runs before the driver's own exit teardown only where it was registered after the + /// driver loaded, after `Device::new`. A second call returns at once, with the first call's + /// answer, or false while the first is still running. pub fn quiesce(&self, timeout: Duration) -> bool { self.shared.halt(Instant::now().checked_add(timeout), true) }