Skip to main content

libasync_sys/
default.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! This file is not generated by bindgen because it doesn't really make sense to use bindgen
6//! to generate two function signatures that are unlikely to change.
7//!
8//! The original definitions are in //sdk/lib/async-default/include/lib/async
9
10use crate::async_dispatcher_t;
11
12unsafe extern "C" {
13    // SAFETY: This API is safe to call at any time.
14    /// Gets the currently active async dispatcher for the current thread, if set.
15    pub safe fn async_get_default_dispatcher() -> *const async_dispatcher_t;
16
17    /// Sets the current thread's default asynchronous dispatcher interface.
18    /// May be set to |NULL| if this thread doesn't have a default dispatcher.
19    ///
20    /// # Safety
21    ///
22    /// The caller must ensure that the dispatcher being passed in is currently
23    /// valid, and that it will remain valid until either the current thread has
24    /// exited or it has been replaced with another dispatcher (including NULL).
25    pub unsafe fn async_set_default_dispatcher(dispatcher: *const async_dispatcher_t);
26}