shadow_rs::utility::legacy_callback_queue

Function with_global_cb_queue

source
pub fn with_global_cb_queue<T>(f: impl FnOnce() -> T) -> T
Expand description

Helper function to initialize and run a global thread-local callback queue.

This is a hack so that C LegacyFiles can queue listener callbacks using notify_listeners_with_global_cb_queue. This is primarily for TCP objects, and should not be used with Rust file objects.

The closure should make any borrows of the file object, rather than making any borrows outside of the closure.