MCPcopy Create free account
hub / github.com/RustCV/RustCV / shutdown_mf

Function shutdown_mf

rustcv-backend-msmf/src/device.rs:78–93  ·  view source on GitHub ↗

Shuts down the Media Foundation subsystem This function decrements the reference count and performs actual shutdown when the count reaches zero. This ensures proper cleanup of resources. Safe to call multiple times.

()

Source from the content-addressed store, hash-verified

76/// when the count reaches zero. This ensures proper cleanup of resources.
77/// Safe to call multiple times.
78pub fn shutdown_mf() {
79 let refcnt = &*CAMERA_REFCNT;
80 // Decrement reference count with SeqCst to ensure proper synchronization
81 // SeqCst ensures that all memory operations before this point are visible
82 // to other threads before we check if we need to shutdown
83 if refcnt.fetch_sub(1, Ordering::SeqCst) == 1 {
84 let initialized = &*INITIALIZED;
85 if initialized.load(Ordering::SeqCst) {
86 unsafe {
87 let _ = MFShutdown();
88 CoUninitialize();
89 }
90 initialized.store(false, Ordering::SeqCst);
91 }
92 }
93}
94
95/// Lists all available camera devices connected to the system
96///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected