function_tobject_tretainreleaseget_contextset_contextset_finalizer_factivate@"suspend"@"resume"_os_object_sdispatch_retaindispatch_releasedispatch_get_contextdispatch_set_contextdispatch_set_finalizer_fdispatch_activatedispatch_suspenddispatch_resumeonce_tonce_fdispatch_once_fqueue_tqueue_global_tqueue_serial_executor_tqueue_serial_tqueue_main_tqueue_concurrent_tasync_fsync_fasync_and_wait_fapply_fget_current_queueget_main_queuequeue_priority_tget_global_queuequeue_attr_tQUEUE_SERIALQUEUE_INACTIVEQUEUE_CONCURRENTQUEUE_CONCURRENT_INACTIVEqueue_attr_make_initially_inactiveTARGET_QUEUE_DEFAULTqueue_create_with_targetqueue_createCURRENT_QUEUE_LABELqueue_get_labelmainafter_fqueue_sdispatch_async_fdispatch_sync_fdispatch_async_and_wait_fdispatch_apply_fdispatch_get_current_queue_dispatch_main_qdispatch_get_global_queuequeue_attr_s_dispatch_queue_attr_concurrentdispatch_queue_attr_make_initially_inactivedispatch_queue_create_with_targetdispatch_queue_createdispatch_queue_get_labeldispatch_set_target_queuedispatch_maindispatch_after_fsemaphore_tsemaphore_createsemaphore_waitsemaphore_signalsemaphore_sdispatch_semaphore_createdispatch_semaphore_waitdispatch_semaphore_signalsource_tsource_type_tSOURCE_TYPE_DATA_ADDSOURCE_TYPE_DATA_ORSOURCE_TYPE_DATA_REPLACESOURCE_TYPE_MACH_SENDSOURCE_TYPE_MACH_RECVSOURCE_TYPE_MEMORYPRESSURESOURCE_TYPE_PROCSOURCE_TYPE_READSOURCE_TYPE_SIGNALSOURCE_TYPE_TIMERSOURCE_TYPE_VNODESOURCE_TYPE_WRITEsource_mach_send_flags_tsource_mach_recv_flags_tsource_memorypressure_flags_tsource_proc_flags_tsource_vnode_flags_tsource_timer_flags_tsource_flags_tsource_createsource_set_event_handler_fsource_set_cancel_handler_fsource_cancelsource_testcancelsource_get_handlesource_get_masksource_get_datasource_merge_datasource_set_timersource_set_registration_handler_fsource_ssource_type_s_dispatch_source_type_data_add_dispatch_source_type_data_or_dispatch_source_type_data_replace_dispatch_source_type_mach_send_dispatch_source_type_mach_recv_dispatch_source_type_memorypressure_dispatch_source_type_proc_dispatch_source_type_read_dispatch_source_type_signal_dispatch_source_type_timer_dispatch_source_type_vnode_dispatch_source_type_writedispatch_source_createdispatch_source_set_event_handler_fdispatch_source_set_cancel_handler_fdispatch_source_canceldispatch_source_testcanceldispatch_source_get_handledispatch_source_get_maskdispatch_source_get_datadispatch_source_merge_datadispatch_source_set_timerdispatch_source_set_registration_handler_ftime_tWALLTIME_NOWTIME_NOWTIME_FOREVERtimewalltimedispatch_timedispatch_walltimebuiltinstd
std.c.darwin.dispatch._dispatch_main_q
variable
queue_s
std.c.darwin.dispatch._dispatch_queue_attr_concurrent
variable
queue_attr_s
std.c.darwin.dispatch._dispatch_source_type_data_add
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_data_or
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_data_replace
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_mach_recv
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_mach_send
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_memorypressure
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_proc
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_read
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_signal
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_timer
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_vnode
constant
source_type_s
std.c.darwin.dispatch._dispatch_source_type_write
constant
source_type_s
std.c.darwin.dispatch._os_object_s
container
std.c.darwin.dispatch._os_object_s.@"resume"
alias
std.c.darwin.dispatch._os_object_s.@"suspend"
alias
std.c.darwin.dispatch._os_object_s.activate
alias
std.c.darwin.dispatch._os_object_s.get_context
alias
std.c.darwin.dispatch._os_object_s.release
alias
std.c.darwin.dispatch._os_object_s.retain
alias
std.c.darwin.dispatch._os_object_s.set_context
alias
std.c.darwin.dispatch._os_object_s.set_finalizer
alias
std.c.darwin.dispatch._os_object_s.set_target_queue
alias
std.c.darwin.dispatch.@"resume"
alias
std.c.darwin.dispatch.@"suspend"
alias
std.c.darwin.dispatch.activate
alias
std.c.darwin.dispatch.after_f
alias
std.c.darwin.dispatch.apply_f
alias
std.c.darwin.dispatch.async_and_wait_f
alias
std.c.darwin.dispatch.async_f
alias
std.c.darwin.dispatch.builtin
constant
std.c.darwin.dispatch.CURRENT_QUEUE_LABEL
primitive
?[*:0]const u8
std.c.darwin.dispatch.dispatch_activate
function
extern "c" fn dispatch_activate(object: object_t) void
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_after_f
function
extern "c" fn dispatch_after_f(when: time_t, queue: queue_t, context: ?*anyopaque, work: function_t) void
Parameters
std.c.darwin.dispatch.dispatch_apply_f
function
extern "c" fn dispatch_apply_f(iterations: usize, queue: ?queue_t, context: ?*anyopaque, work: *const fn (context: ?*anyopaque, iteration: usize) callconv(.c) void) void
Parameters
iterations: usize
queue: ?queue_t
context: ?*anyopaque
work: *const fn (context: ?*anyopaque, iteration: usize) callconv(.c) void
std.c.darwin.dispatch.dispatch_async_and_wait_f
function
extern "c" fn dispatch_async_and_wait_f(queue: queue_t, context: ?*anyopaque, work: function_t) void
Parameters
std.c.darwin.dispatch.dispatch_async_f
function
extern "c" fn dispatch_async_f(queue: queue_t, context: ?*anyopaque, work: function_t) void
Parameters
std.c.darwin.dispatch.dispatch_get_context
function
extern "c" fn dispatch_get_context(object: object_t) ?*anyopaque
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_get_current_queue
function
extern "c" fn dispatch_get_current_queue() queue_t
std.c.darwin.dispatch.dispatch_get_global_queue
function
extern "c" fn dispatch_get_global_queue(identifier: isize, flags: usize) queue_global_t
Parameters
identifier: isize
flags: usize
std.c.darwin.dispatch.dispatch_main
function
extern "c" fn dispatch_main() noreturn
std.c.darwin.dispatch.dispatch_once_f
function
extern "c" fn dispatch_once_f(predicate: *once_t, context: ?*anyopaque, function: function_t) void
Parameters
std.c.darwin.dispatch.dispatch_queue_attr_make_initially_inactive
function
extern "c" fn dispatch_queue_attr_make_initially_inactive(attr: queue_attr_t) queue_attr_t
Parameters
attr: queue_attr_t
std.c.darwin.dispatch.dispatch_queue_create
function
extern "c" fn dispatch_queue_create(label: ?[*:0]const u8, attr: queue_attr_t) ?queue_t
Parameters
label: ?[*:0]const u8
attr: queue_attr_t
std.c.darwin.dispatch.dispatch_queue_create_with_target
function
extern "c" fn dispatch_queue_create_with_target(label: ?[*:0]const u8, attr: queue_attr_t, target: ?queue_t) ?queue_t
Parameters
std.c.darwin.dispatch.dispatch_queue_get_label
function
extern "c" fn dispatch_queue_get_label(queue: ?queue_t) [*:0]const u8
Parameters
queue: ?queue_t
std.c.darwin.dispatch.dispatch_release
function
extern "c" fn dispatch_release(object: object_t) void
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_resume
function
extern "c" fn dispatch_resume(object: object_t) void
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_retain
function
extern "c" fn dispatch_retain(object: object_t) void
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_semaphore_create
function
extern "c" fn dispatch_semaphore_create(value: isize) ?semaphore_t
Parameters
value: isize
std.c.darwin.dispatch.dispatch_semaphore_signal
function
extern "c" fn dispatch_semaphore_signal(dsema: semaphore_t) isize
Parameters
dsema: semaphore_t
std.c.darwin.dispatch.dispatch_semaphore_wait
function
extern "c" fn dispatch_semaphore_wait(dsema: semaphore_t, timeout: time_t) isize
Parameters
dsema: semaphore_t
timeout: time_t
std.c.darwin.dispatch.dispatch_set_context
function
extern "c" fn dispatch_set_context(object: object_t, context: ?*anyopaque) void
Parameters
object: object_t
context: ?*anyopaque
std.c.darwin.dispatch.dispatch_set_finalizer_f
function
extern "c" fn dispatch_set_finalizer_f(object: object_t, finalizer: ?function_t) void
Parameters
object: object_t
finalizer: ?function_t
std.c.darwin.dispatch.dispatch_set_target_queue
function
extern "c" fn dispatch_set_target_queue(object: object_t, queue: ?queue_t) void
Parameters
std.c.darwin.dispatch.dispatch_source_cancel
function
extern "c" fn dispatch_source_cancel(source: source_t) void
Parameters
source: source_t
std.c.darwin.dispatch.dispatch_source_create
function
extern "c" fn dispatch_source_create(type: source_type_t, handle: usize, mask: source_flags_t, queue: ?queue_t) ?source_t
Parameters
std.c.darwin.dispatch.dispatch_source_get_data
function
extern "c" fn dispatch_source_get_data(source: source_t) usize
Parameters
source: source_t
std.c.darwin.dispatch.dispatch_source_get_handle
function
extern "c" fn dispatch_source_get_handle(source: source_t) usize
Parameters
source: source_t
std.c.darwin.dispatch.dispatch_source_get_mask
function
extern "c" fn dispatch_source_get_mask(source: source_t) source_flags_t
Parameters
source: source_t
std.c.darwin.dispatch.dispatch_source_merge_data
function
extern "c" fn dispatch_source_merge_data(source: source_t, value: usize) void
Parameters
source: source_t
value: usize
std.c.darwin.dispatch.dispatch_source_set_cancel_handler_f
function
extern "c" fn dispatch_source_set_cancel_handler_f(source: source_t, handler: ?function_t) void
Parameters
source: source_t
handler: ?function_t
std.c.darwin.dispatch.dispatch_source_set_event_handler_f
function
extern "c" fn dispatch_source_set_event_handler_f(source: source_t, handler: ?function_t) void
Parameters
source: source_t
handler: ?function_t
std.c.darwin.dispatch.dispatch_source_set_registration_handler_f
function
extern "c" fn dispatch_source_set_registration_handler_f(source: source_t, handler: ?function_t) void
Parameters
source: source_t
handler: ?function_t
std.c.darwin.dispatch.dispatch_source_set_timer
function
extern "c" fn dispatch_source_set_timer(source: source_t, start: time_t, interval: u64, leeway: u64) void
Parameters
std.c.darwin.dispatch.dispatch_source_testcancel
function
extern "c" fn dispatch_source_testcancel(source: source_t) isize
Parameters
source: source_t
std.c.darwin.dispatch.dispatch_suspend
function
extern "c" fn dispatch_suspend(object: object_t) void
Parameters
object: object_t
std.c.darwin.dispatch.dispatch_sync_f
function
extern "c" fn dispatch_sync_f(queue: queue_t, context: ?*anyopaque, work: function_t) void
Parameters
std.c.darwin.dispatch.dispatch_time
function
extern "c" fn dispatch_time(when: time_t, delta: i64) time_t
Parameters
when: time_t
delta: i64
std.c.darwin.dispatch.dispatch_walltime
function
extern "c" fn dispatch_walltime(when: ?*const std.c.timespec, delta: i64) time_t
Parameters
std.c.darwin.dispatch.function_t
type
std.c.darwin.dispatch.get_context
alias
std.c.darwin.dispatch.get_current_queue
alias
std.c.darwin.dispatch.get_global_queue
alias
std.c.darwin.dispatch.get_main_queue
function
pub inline fn get_main_queue() queue_main_t
std.c.darwin.dispatch.main
alias
Alias of std.c.darwin.dispatch.dispatch_main
std.c.darwin.dispatch.object_t
type
std.c.darwin.dispatch.once_f
alias
std.c.darwin.dispatch.once_t
container
Fields
init = 0
done = -1
_
std.c.darwin.dispatch.once_t.once
function
pub inline fn once(predicate: *once_t, context: ?*anyopaque, function: function_t) void
Parameters
std.c.darwin.dispatch.queue_attr_make_initially_inactive
alias
Alias of std.c.darwin.dispatch.dispatch_queue_attr_make_initially_inactive
std.c.darwin.dispatch.queue_attr_s
container
std.c.darwin.dispatch.queue_attr_s.as_object
function
pub inline fn as_object(queue_attr: queue_attr_t) object_t
Parameters
queue_attr: queue_attr_t
std.c.darwin.dispatch.queue_attr_s.CONCURRENT
alias
std.c.darwin.dispatch.queue_attr_s.CONCURRENT_INACTIVE
alias
std.c.darwin.dispatch.queue_attr_s.INACTIVE
alias
Alias of std.c.darwin.dispatch.QUEUE_INACTIVE
std.c.darwin.dispatch.queue_attr_s.SERIAL
alias
Alias of std.c.darwin.dispatch.QUEUE_SERIAL
std.c.darwin.dispatch.queue_attr_t
type
std.c.darwin.dispatch.QUEUE_CONCURRENT
function
pub inline fn QUEUE_CONCURRENT() queue_attr_t
std.c.darwin.dispatch.QUEUE_CONCURRENT_INACTIVE
function
pub inline fn QUEUE_CONCURRENT_INACTIVE() queue_attr_t
std.c.darwin.dispatch.queue_concurrent_t
alias
Alias of std.c.darwin.dispatch.queue_t
std.c.darwin.dispatch.queue_create
alias
std.c.darwin.dispatch.queue_create_with_target
alias
Alias of std.c.darwin.dispatch.dispatch_queue_create_with_target
std.c.darwin.dispatch.queue_get_label
alias
std.c.darwin.dispatch.queue_global_t
alias
Alias of std.c.darwin.dispatch.queue_t
std.c.darwin.dispatch.QUEUE_INACTIVE
function
pub inline fn QUEUE_INACTIVE() queue_attr_t
std.c.darwin.dispatch.queue_main_t
alias
Alias of std.c.darwin.dispatch.queue_serial_t
std.c.darwin.dispatch.queue_priority_t
container
Fields
std.c.darwin.dispatch.queue_s
container
std.c.darwin.dispatch.queue_s.apply
alias
Alias of std.c.darwin.dispatch.apply_f
std.c.darwin.dispatch.queue_s.as_object
function
pub inline fn as_object(queue: queue_t) object_t
Parameters
queue: queue_t
std.c.darwin.dispatch.queue_s.async
alias
Alias of std.c.darwin.dispatch.async_f
std.c.darwin.dispatch.queue_s.async_and_wait
alias
std.c.darwin.dispatch.queue_s.create
alias
Alias of std.c.darwin.dispatch.queue_create
std.c.darwin.dispatch.queue_s.create_with_target
alias
std.c.darwin.dispatch.queue_s.get_current
alias
std.c.darwin.dispatch.queue_s.get_global
alias
std.c.darwin.dispatch.queue_s.get_label
alias
std.c.darwin.dispatch.queue_s.get_main
alias
Alias of std.c.darwin.dispatch.get_main_queue
std.c.darwin.dispatch.queue_s.sync
alias
Alias of std.c.darwin.dispatch.sync_f
std.c.darwin.dispatch.queue_s.TARGET_DEFAULT
alias
std.c.darwin.dispatch.QUEUE_SERIAL
function
pub inline fn QUEUE_SERIAL() queue_attr_t
std.c.darwin.dispatch.queue_serial_executor_t
alias
Alias of std.c.darwin.dispatch.queue_t
std.c.darwin.dispatch.queue_serial_t
alias
Alias of std.c.darwin.dispatch.queue_t
std.c.darwin.dispatch.queue_t
type
std.c.darwin.dispatch.release
alias
std.c.darwin.dispatch.retain
alias
std.c.darwin.dispatch.semaphore_create
alias
std.c.darwin.dispatch.semaphore_s
container
std.c.darwin.dispatch.semaphore_s.as_object
function
pub inline fn as_object(semaphore: semaphore_t) object_t
Parameters
semaphore: semaphore_t
std.c.darwin.dispatch.semaphore_s.create
alias
std.c.darwin.dispatch.semaphore_s.signal
alias
std.c.darwin.dispatch.semaphore_s.wait
alias
Alias of std.c.darwin.dispatch.semaphore_wait
std.c.darwin.dispatch.semaphore_signal
alias
std.c.darwin.dispatch.semaphore_t
type
std.c.darwin.dispatch.semaphore_wait
alias
std.c.darwin.dispatch.set_context
alias
std.c.darwin.dispatch.set_finalizer_f
alias
std.c.darwin.dispatch.source_cancel
alias
std.c.darwin.dispatch.source_create
alias
std.c.darwin.dispatch.source_flags_t
container
Fields
raw: usize
MACH_SEND: source_mach_send_flags_t
MACH_RECV: source_mach_recv_flags_t
MEMORYPRESSURE: source_memorypressure_flags_t
PROC: source_proc_flags_t
VNODE: source_vnode_flags_t
std.c.darwin.dispatch.source_flags_t.none
constant
source_flags_t
std.c.darwin.dispatch.source_get_data
alias
std.c.darwin.dispatch.source_get_handle
alias
std.c.darwin.dispatch.source_get_mask
alias
std.c.darwin.dispatch.source_mach_recv_flags_t
container
Fields
unused0: @Int(.unsigned, @bitSizeOf(usize) - 0) = 0
std.c.darwin.dispatch.source_mach_send_flags_t
container
Fields
DEAD: bool = false
unused1: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0
std.c.darwin.dispatch.source_memorypressure_flags_t
container
Fields
NORMAL: bool = false
WARN: bool = false
CRITICAL: bool = false
unused3: @Int(.unsigned, @bitSizeOf(usize) - 3) = 0
std.c.darwin.dispatch.source_merge_data
alias
std.c.darwin.dispatch.source_proc_flags_t
container
Fields
unused0: u27 = 0
SIGNAL: bool = false
unused28: u1 = 0
EXEC: bool = false
FORK: bool = false
EXIT: bool = false
unused32: @Int(.unsigned, @bitSizeOf(usize) - 32) = 0
std.c.darwin.dispatch.source_s
container
std.c.darwin.dispatch.source_s.as_object
function
pub inline fn as_object(source: source_t) object_t
Parameters
source: source_t
std.c.darwin.dispatch.source_s.cancel
alias
Alias of std.c.darwin.dispatch.source_cancel
std.c.darwin.dispatch.source_s.get_data
alias
std.c.darwin.dispatch.source_s.get_handle
alias
std.c.darwin.dispatch.source_s.get_mask
alias
std.c.darwin.dispatch.source_s.merge_data
alias
std.c.darwin.dispatch.source_s.set_cancel_handler
alias
std.c.darwin.dispatch.source_s.set_event_handler
alias
std.c.darwin.dispatch.source_s.set_registration_handler
alias
Alias of std.c.darwin.dispatch.source_set_registration_handler_f
std.c.darwin.dispatch.source_s.set_timer
alias
std.c.darwin.dispatch.source_s.testcancel
alias
std.c.darwin.dispatch.source_set_cancel_handler_f
alias
Alias of std.c.darwin.dispatch.dispatch_source_set_cancel_handler_f
std.c.darwin.dispatch.source_set_event_handler_f
alias
Alias of std.c.darwin.dispatch.dispatch_source_set_event_handler_f
std.c.darwin.dispatch.source_set_registration_handler_f
alias
Alias of std.c.darwin.dispatch.dispatch_source_set_registration_handler_f
std.c.darwin.dispatch.source_set_timer
alias
std.c.darwin.dispatch.source_t
type
std.c.darwin.dispatch.source_testcancel
alias
std.c.darwin.dispatch.source_timer_flags_t
container
Fields
STRICT: bool = false
unused1: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0
std.c.darwin.dispatch.SOURCE_TYPE_DATA_ADD
constant
std.c.darwin.dispatch.SOURCE_TYPE_DATA_OR
constant
std.c.darwin.dispatch.SOURCE_TYPE_DATA_REPLACE
constant
std.c.darwin.dispatch.SOURCE_TYPE_MACH_RECV
constant
std.c.darwin.dispatch.SOURCE_TYPE_MACH_SEND
constant
std.c.darwin.dispatch.SOURCE_TYPE_MEMORYPRESSURE
constant
std.c.darwin.dispatch.SOURCE_TYPE_PROC
constant
std.c.darwin.dispatch.SOURCE_TYPE_READ
constant
std.c.darwin.dispatch.source_type_s
container
std.c.darwin.dispatch.source_type_s.DATA_ADD
alias
std.c.darwin.dispatch.source_type_s.DATA_OR
alias
std.c.darwin.dispatch.source_type_s.DATA_REPLACE
alias
std.c.darwin.dispatch.source_type_s.MACH_RECV
alias
std.c.darwin.dispatch.source_type_s.MACH_SEND
alias
std.c.darwin.dispatch.source_type_s.MEMORYPRESSURE
alias
std.c.darwin.dispatch.source_type_s.PROC
alias
std.c.darwin.dispatch.source_type_s.READ
alias
std.c.darwin.dispatch.source_type_s.SIGNAL
alias
std.c.darwin.dispatch.source_type_s.TIMER
alias
std.c.darwin.dispatch.source_type_s.VNODE
alias
std.c.darwin.dispatch.source_type_s.WRITE
alias
std.c.darwin.dispatch.SOURCE_TYPE_SIGNAL
constant
std.c.darwin.dispatch.source_type_t
type
std.c.darwin.dispatch.SOURCE_TYPE_TIMER
constant
std.c.darwin.dispatch.SOURCE_TYPE_VNODE
constant
std.c.darwin.dispatch.SOURCE_TYPE_WRITE
constant
std.c.darwin.dispatch.source_vnode_flags_t
container
Fields
DELETE: bool = false
WRITE: bool = false
EXTEND: bool = false
ATTRIB: bool = false
LINK: bool = false
RENAME: bool = false
REVOKE: bool = false
unused7: u1 = 0
FUNLOCK: bool = false
unused9: @Int(.unsigned, @bitSizeOf(usize) - 9) = 0
std.c.darwin.dispatch.std
alias
Alias of std
std.c.darwin.dispatch.sync_f
alias
std.c.darwin.dispatch.TARGET_QUEUE_DEFAULT
primitive
?queue_t
std.c.darwin.dispatch.time
alias
Alias of std.c.darwin.dispatch.dispatch_time
std.c.darwin.dispatch.TIME_FOREVER
constant
std.c.darwin.dispatch.TIME_NOW
constant
u64
std.c.darwin.dispatch.time_t
container
Fields
std.c.darwin.dispatch.time_t.after
alias
std.c.darwin.dispatch.time_t.time
alias
Alias of std.c.darwin.dispatch.dispatch_time
std.c.darwin.dispatch.time_t.walltime
alias
std.c.darwin.dispatch.walltime
alias
std.c.darwin.dispatch.WALLTIME_NOW
constant
Source code
std/c/darwin/dispatch.zig
// dispatch/base.h
pub const function_t = *const fn (?*anyopaque) callconv(.c) void;
// dispatch/object.h
pub const object_t = *_os_object_s;
pub const retain = dispatch_retain;
pub const release = dispatch_release;
pub const get_context = dispatch_get_context;
pub const set_context = dispatch_set_context;
pub const set_finalizer_f = dispatch_set_finalizer_f;
pub const activate = dispatch_activate;
pub const @"suspend" = dispatch_suspend;
pub const @"resume" = dispatch_resume;
const _os_object_s = opaque {
pub const retain = dispatch_retain;
pub const release = dispatch_release;
pub const get_context = dispatch_get_context;
pub const set_context = dispatch_set_context;
pub const set_finalizer = dispatch_set_finalizer_f;
pub const activate = dispatch_activate;
pub const @"suspend" = dispatch_suspend;
pub const @"resume" = dispatch_resume;
pub const set_target_queue = dispatch_set_target_queue;
};
extern "c" fn dispatch_retain(object: object_t) void;
extern "c" fn dispatch_release(object: object_t) void;
extern "c" fn dispatch_get_context(object: object_t) ?*anyopaque;
extern "c" fn dispatch_set_context(object: object_t, context: ?*anyopaque) void;
extern "c" fn dispatch_set_finalizer_f(object: object_t, finalizer: ?function_t) void;
extern "c" fn dispatch_activate(object: object_t) void;
extern "c" fn dispatch_suspend(object: object_t) void;
extern "c" fn dispatch_resume(object: object_t) void;
// dispatch/once.h
pub const once_t = enum(isize) {
init = 0,
done = -1,
_,
pub inline fn once(predicate: *once_t, context: ?*anyopaque, function: function_t) void {
if (predicate.* != .done) {
@branchHint(.unlikely);
once_f(predicate, context, function);
} else asm volatile ("" ::: .{ .memory = true });
switch (builtin.mode) {
.debug, .safe => {},
.fast, .small => if (predicate.* != .done) unreachable,
}
}
};
pub const once_f = dispatch_once_f;
extern "c" fn dispatch_once_f(predicate: *once_t, context: ?*anyopaque, function: function_t) void;
// dispatch/queue.h
pub const queue_t = *queue_s;
pub const queue_global_t = queue_t;
pub const queue_serial_executor_t = queue_t;
pub const queue_serial_t = queue_t;
pub const queue_main_t = queue_serial_t;
pub const queue_concurrent_t = queue_t;
pub const async_f = dispatch_async_f;
pub const sync_f = dispatch_sync_f;
pub const async_and_wait_f = dispatch_async_and_wait_f;
pub const apply_f = dispatch_apply_f;
pub const get_current_queue = dispatch_get_current_queue;
pub inline fn get_main_queue() queue_main_t {
return &_dispatch_main_q;
}
pub const queue_priority_t = enum(c_long) {
HIGH = 2,
DEFAULT = 0,
LOW = -1,
BACKGROUND = std.math.minInt(i16),
_,
};
pub const get_global_queue = dispatch_get_global_queue;
pub const queue_attr_t = ?*queue_attr_s;
pub inline fn QUEUE_SERIAL() queue_attr_t {
return null;
}
pub inline fn QUEUE_INACTIVE() queue_attr_t {
return queue_attr_make_initially_inactive(QUEUE_SERIAL());
}
pub inline fn QUEUE_CONCURRENT() queue_attr_t {
return &_dispatch_queue_attr_concurrent;
}
pub inline fn QUEUE_CONCURRENT_INACTIVE() queue_attr_t {
return queue_attr_make_initially_inactive(QUEUE_CONCURRENT());
}
pub const queue_attr_make_initially_inactive = dispatch_queue_attr_make_initially_inactive;
pub const TARGET_QUEUE_DEFAULT: ?queue_t = null;
pub const queue_create_with_target = dispatch_queue_create_with_target;
pub const queue_create = dispatch_queue_create;
pub const CURRENT_QUEUE_LABEL: ?[*:0]const u8 = null;
pub const queue_get_label = dispatch_queue_get_label;
pub const main = dispatch_main;
pub const after_f = dispatch_after_f;
const queue_s = opaque {
pub inline fn as_object(queue: queue_t) object_t {
return @ptrCast(queue);
}
pub const async = async_f;
pub const sync = sync_f;
pub const async_and_wait = async_and_wait_f;
pub const apply = apply_f;
pub const get_current = get_current_queue;
pub const get_main = get_main_queue;
pub const get_global = get_global_queue;
pub const TARGET_DEFAULT = TARGET_QUEUE_DEFAULT;
pub const create_with_target = queue_create_with_target;
pub const create = queue_create;
pub const get_label = queue_get_label;
};
extern "c" fn dispatch_async_f(queue: queue_t, context: ?*anyopaque, work: function_t) void;
extern "c" fn dispatch_sync_f(queue: queue_t, context: ?*anyopaque, work: function_t) void;
extern "c" fn dispatch_async_and_wait_f(queue: queue_t, context: ?*anyopaque, work: function_t) void;
extern "c" fn dispatch_apply_f(iterations: usize, queue: ?queue_t, context: ?*anyopaque, work: *const fn (context: ?*anyopaque, iteration: usize) callconv(.c) void) void;
extern "c" fn dispatch_get_current_queue() queue_t;
extern "c" var _dispatch_main_q: queue_s;
extern "c" fn dispatch_get_global_queue(identifier: isize, flags: usize) queue_global_t;
const queue_attr_s = opaque {
pub inline fn as_object(queue_attr: queue_attr_t) object_t {
return @ptrCast(queue_attr);
}
pub const SERIAL = QUEUE_SERIAL;
pub const INACTIVE = QUEUE_INACTIVE;
pub const CONCURRENT = QUEUE_CONCURRENT;
pub const CONCURRENT_INACTIVE = QUEUE_CONCURRENT_INACTIVE;
};
extern "c" var _dispatch_queue_attr_concurrent: queue_attr_s;
extern "c" fn dispatch_queue_attr_make_initially_inactive(attr: queue_attr_t) queue_attr_t;
extern "c" fn dispatch_queue_create_with_target(label: ?[*:0]const u8, attr: queue_attr_t, target: ?queue_t) ?queue_t;
extern "c" fn dispatch_queue_create(label: ?[*:0]const u8, attr: queue_attr_t) ?queue_t;
extern "c" fn dispatch_queue_get_label(queue: ?queue_t) [*:0]const u8;
extern "c" fn dispatch_set_target_queue(object: object_t, queue: ?queue_t) void;
extern "c" fn dispatch_main() noreturn;
extern "c" fn dispatch_after_f(when: time_t, queue: queue_t, context: ?*anyopaque, work: function_t) void;
// dispatch/semaphore.h
pub const semaphore_t = *semaphore_s;
pub const semaphore_create = dispatch_semaphore_create;
pub const semaphore_wait = dispatch_semaphore_wait;
pub const semaphore_signal = dispatch_semaphore_signal;
const semaphore_s = opaque {
pub inline fn as_object(semaphore: semaphore_t) object_t {
return @ptrCast(semaphore);
}
pub const create = semaphore_create;
pub const wait = semaphore_wait;
pub const signal = semaphore_signal;
};
extern "c" fn dispatch_semaphore_create(value: isize) ?semaphore_t;
extern "c" fn dispatch_semaphore_wait(dsema: semaphore_t, timeout: time_t) isize;
extern "c" fn dispatch_semaphore_signal(dsema: semaphore_t) isize;
// dispatch/source.h
pub const source_t = *source_s;
pub const source_type_t = *const source_type_s;
pub const SOURCE_TYPE_DATA_ADD = &_dispatch_source_type_data_add;
pub const SOURCE_TYPE_DATA_OR = &_dispatch_source_type_data_or;
pub const SOURCE_TYPE_DATA_REPLACE = &_dispatch_source_type_data_replace;
pub const SOURCE_TYPE_MACH_SEND = &_dispatch_source_type_mach_send;
pub const SOURCE_TYPE_MACH_RECV = &_dispatch_source_type_mach_recv;
pub const SOURCE_TYPE_MEMORYPRESSURE = &_dispatch_source_type_memorypressure;
pub const SOURCE_TYPE_PROC = &_dispatch_source_type_proc;
pub const SOURCE_TYPE_READ = &_dispatch_source_type_read;
pub const SOURCE_TYPE_SIGNAL = &_dispatch_source_type_signal;
pub const SOURCE_TYPE_TIMER = &_dispatch_source_type_timer;
pub const SOURCE_TYPE_VNODE = &_dispatch_source_type_vnode;
pub const SOURCE_TYPE_WRITE = &_dispatch_source_type_write;
pub const source_mach_send_flags_t = packed struct(usize) {
DEAD: bool = false,
unused1: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0,
};
pub const source_mach_recv_flags_t = packed struct(usize) {
unused0: @Int(.unsigned, @bitSizeOf(usize) - 0) = 0,
};
pub const source_memorypressure_flags_t = packed struct(usize) {
NORMAL: bool = false,
WARN: bool = false,
CRITICAL: bool = false,
unused3: @Int(.unsigned, @bitSizeOf(usize) - 3) = 0,
};
pub const source_proc_flags_t = packed struct(usize) {
unused0: u27 = 0,
SIGNAL: bool = false,
unused28: u1 = 0,
EXEC: bool = false,
FORK: bool = false,
EXIT: bool = false,
unused32: @Int(.unsigned, @bitSizeOf(usize) - 32) = 0,
};
pub const source_vnode_flags_t = packed struct(usize) {
DELETE: bool = false,
WRITE: bool = false,
EXTEND: bool = false,
ATTRIB: bool = false,
LINK: bool = false,
RENAME: bool = false,
REVOKE: bool = false,
unused7: u1 = 0,
FUNLOCK: bool = false,
unused9: @Int(.unsigned, @bitSizeOf(usize) - 9) = 0,
};
pub const source_timer_flags_t = packed struct(usize) {
STRICT: bool = false,
unused1: @Int(.unsigned, @bitSizeOf(usize) - 1) = 0,
};
pub const source_flags_t = packed union(usize) {
raw: usize,
MACH_SEND: source_mach_send_flags_t,
MACH_RECV: source_mach_recv_flags_t,
MEMORYPRESSURE: source_memorypressure_flags_t,
PROC: source_proc_flags_t,
VNODE: source_vnode_flags_t,
pub const none: source_flags_t = .{ .raw = 0 };
};
pub const source_create = dispatch_source_create;
pub const source_set_event_handler_f = dispatch_source_set_event_handler_f;
pub const source_set_cancel_handler_f = dispatch_source_set_cancel_handler_f;
pub const source_cancel = dispatch_source_cancel;
pub const source_testcancel = dispatch_source_testcancel;
pub const source_get_handle = dispatch_source_get_handle;
pub const source_get_mask = dispatch_source_get_mask;
pub const source_get_data = dispatch_source_get_data;
pub const source_merge_data = dispatch_source_merge_data;
pub const source_set_timer = dispatch_source_set_timer;
pub const source_set_registration_handler_f = dispatch_source_set_registration_handler_f;
const source_s = opaque {
pub inline fn as_object(source: source_t) object_t {
return @ptrCast(source);
}
pub const set_event_handler = source_set_event_handler_f;
pub const set_cancel_handler = source_set_cancel_handler_f;
pub const cancel = source_cancel;
pub const testcancel = source_testcancel;
pub const get_handle = source_get_handle;
pub const get_mask = source_get_mask;
pub const get_data = source_get_data;
pub const merge_data = source_merge_data;
pub const set_timer = source_set_timer;
pub const set_registration_handler = source_set_registration_handler_f;
};
const source_type_s = opaque {
pub const DATA_ADD = SOURCE_TYPE_DATA_ADD;
pub const DATA_OR = SOURCE_TYPE_DATA_OR;
pub const DATA_REPLACE = SOURCE_TYPE_DATA_REPLACE;
pub const MACH_SEND = SOURCE_TYPE_MACH_SEND;
pub const MACH_RECV = SOURCE_TYPE_MACH_RECV;
pub const MEMORYPRESSURE = SOURCE_TYPE_MEMORYPRESSURE;
pub const PROC = SOURCE_TYPE_PROC;
pub const READ = SOURCE_TYPE_READ;
pub const SIGNAL = SOURCE_TYPE_SIGNAL;
pub const TIMER = SOURCE_TYPE_TIMER;
pub const VNODE = SOURCE_TYPE_VNODE;
pub const WRITE = SOURCE_TYPE_WRITE;
};
extern "c" const _dispatch_source_type_data_add: source_type_s;
extern "c" const _dispatch_source_type_data_or: source_type_s;
extern "c" const _dispatch_source_type_data_replace: source_type_s;
extern "c" const _dispatch_source_type_mach_send: source_type_s;
extern "c" const _dispatch_source_type_mach_recv: source_type_s;
extern "c" const _dispatch_source_type_memorypressure: source_type_s;
extern "c" const _dispatch_source_type_proc: source_type_s;
extern "c" const _dispatch_source_type_read: source_type_s;
extern "c" const _dispatch_source_type_signal: source_type_s;
extern "c" const _dispatch_source_type_timer: source_type_s;
extern "c" const _dispatch_source_type_vnode: source_type_s;
extern "c" const _dispatch_source_type_write: source_type_s;
extern "c" fn dispatch_source_create(type: source_type_t, handle: usize, mask: source_flags_t, queue: ?queue_t) ?source_t;
extern "c" fn dispatch_source_set_event_handler_f(source: source_t, handler: ?function_t) void;
extern "c" fn dispatch_source_set_cancel_handler_f(source: source_t, handler: ?function_t) void;
extern "c" fn dispatch_source_cancel(source: source_t) void;
extern "c" fn dispatch_source_testcancel(source: source_t) isize;
extern "c" fn dispatch_source_get_handle(source: source_t) usize;
extern "c" fn dispatch_source_get_mask(source: source_t) source_flags_t;
extern "c" fn dispatch_source_get_data(source: source_t) usize;
extern "c" fn dispatch_source_merge_data(source: source_t, value: usize) void;
extern "c" fn dispatch_source_set_timer(source: source_t, start: time_t, interval: u64, leeway: u64) void;
extern "c" fn dispatch_source_set_registration_handler_f(source: source_t, handler: ?function_t) void;
// dispatch/time.h
pub const time_t = enum(u64) {
WALL_NOW = WALLTIME_NOW,
NOW = TIME_NOW,
FOREVER = TIME_FOREVER,
_,
pub const time = dispatch_time;
pub const walltime = dispatch_walltime;
pub const after = dispatch_after_f;
};
pub const WALLTIME_NOW = ~@as(u64, 1);
pub const TIME_NOW: u64 = 0;
pub const TIME_FOREVER = ~@as(u64, 0);
pub const time = dispatch_time;
pub const walltime = dispatch_walltime;
extern "c" fn dispatch_time(when: time_t, delta: i64) time_t;
extern "c" fn dispatch_walltime(when: ?*const std.c.timespec, delta: i64) time_t;
const builtin = @import("builtin");
const std = @import("std");