Skip to main content

apple_cf/ffi/
dispatch_extras.rs

1#![allow(missing_docs)]
2
3use core::ffi::c_void;
4
5extern "C" {
6    /// Swift bridge function `acf_dispatch_async_f` for the corresponding Apple API.
7    pub fn acf_dispatch_async_f(
8        queue: *mut c_void,
9        context: *mut c_void,
10        work: extern "C" fn(*mut c_void),
11    );
12    /// Swift bridge function `acf_dispatch_async_and_wait_f` for the corresponding Apple API.
13    pub fn acf_dispatch_async_and_wait_f(
14        queue: *mut c_void,
15        context: *mut c_void,
16        work: extern "C" fn(*mut c_void),
17    );
18    pub fn acf_dispatch_after_f(
19        delay_ns: u64,
20        queue: *mut c_void,
21        context: *mut c_void,
22        work: extern "C" fn(*mut c_void),
23    );
24    /// Swift bridge function `acf_dispatch_apply_f` for the corresponding Apple API.
25    pub fn acf_dispatch_apply_f(
26        iterations: usize,
27        queue: *mut c_void,
28        context: *mut c_void,
29        work: extern "C" fn(usize, *mut c_void),
30    );
31
32    /// Swift bridge function `acf_dispatch_group_holder_create` for the corresponding Apple API.
33    pub fn acf_dispatch_group_holder_create() -> *mut c_void;
34    /// Swift bridge function `acf_dispatch_group_holder_enter` for the corresponding Apple API.
35    pub fn acf_dispatch_group_holder_enter(group: *mut c_void);
36    /// Swift bridge function `acf_dispatch_group_holder_leave` for the corresponding Apple API.
37    pub fn acf_dispatch_group_holder_leave(group: *mut c_void);
38    /// Swift bridge function `acf_dispatch_group_holder_wait` for the corresponding Apple API.
39    pub fn acf_dispatch_group_holder_wait(group: *mut c_void, timeout_ms: i64) -> bool;
40
41    /// Swift bridge function `acf_dispatch_semaphore_holder_create` for the corresponding Apple API.
42    pub fn acf_dispatch_semaphore_holder_create(value: i64) -> *mut c_void;
43    /// Swift bridge function `acf_dispatch_semaphore_holder_signal` for the corresponding Apple API.
44    pub fn acf_dispatch_semaphore_holder_signal(semaphore: *mut c_void) -> i64;
45    /// Swift bridge function `acf_dispatch_semaphore_holder_wait` for the corresponding Apple API.
46    pub fn acf_dispatch_semaphore_holder_wait(semaphore: *mut c_void, timeout_ms: i64) -> bool;
47
48    /// Swift bridge function `acf_dispatch_source_timer_create` for the corresponding Apple API.
49    pub fn acf_dispatch_source_timer_create(interval_ms: u64, leeway_ms: u64) -> *mut c_void;
50    pub fn acf_dispatch_source_timer_create_ns(interval_ns: u64, leeway_ns: u64) -> *mut c_void;
51    /// Swift bridge function `acf_dispatch_source_timer_resume` for the corresponding Apple API.
52    pub fn acf_dispatch_source_timer_resume(source: *mut c_void);
53    /// Swift bridge function `acf_dispatch_source_timer_cancel` for the corresponding Apple API.
54    pub fn acf_dispatch_source_timer_cancel(source: *mut c_void);
55    /// Swift bridge function `acf_dispatch_source_timer_fire_count` for the corresponding Apple API.
56    pub fn acf_dispatch_source_timer_fire_count(source: *mut c_void) -> u64;
57}