Function gio::spawn_blocking

source ·
pub fn spawn_blocking<T, F>(func: F) -> JoinHandle<T> where
    T: Send + 'static,
    F: FnOnce() -> T + Send + 'static,
Expand description

Runs a blocking I/O task on the I/O thread pool.

Calls func on the internal Gio thread pool for blocking I/O operations. The thread pool is shared with other Gio async I/O operations, and may rate-limit the tasks it receives. Callers may want to avoid blocking indefinitely by making sure blocking calls eventually time out.

This function should not be used to spawn async tasks. Instead, use glib::MainContext::spawn or glib::MainContext::spawn_local to run a future.