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.
This commit is contained in:
Anees Iqbal committed 2026-11-17 07:25:31 -08:00
1 parent de9b63d93a
commit b216007f0a
1 file changed
+6 -4
+6 -4
View File
@@ -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)
}