Crate dispatch2

Source
Expand description

§Apple’s Dispatch (Grand Central Dispatch)

This crate provides a safe and sound interface to Apple’s Grand Central dispatch.

See Apple’s documentation and the source code for libdispatch for more details.

§Example

use dispatch2::{DispatchQueue, DispatchQueueAttr};

let queue = DispatchQueue::new("example_queue", DispatchQueueAttr::SERIAL);
queue.exec_async(|| println!("Hello"));
queue.exec_sync(|| println!("World"));

Structs§

DispatchAutoReleaseFrequency
Values to pass to the dispatch_queue_attr_make_with_autorelease_frequency() function.
DispatchData
Dispatch data.
DispatchGroup
Dispatch group.
DispatchGroupGuard
Dispatch group guard.
DispatchIO
Dispatch IO.
DispatchIOCloseFlags
DispatchIOIntervalFlags
DispatchIOStreamType
DispatchOnce
A low-level synchronization primitive for one-time global execution.
DispatchQoS
Quality-of-service classes that specify the priorities for executing tasks.
DispatchQueue
Dispatch queue.
DispatchQueueAttr
Dispatch queue attribute.
DispatchQueueGlobalPriority
Queue priority.
DispatchRetained
A reference counted pointer type for Dispatch objects.
DispatchSemaphore
Dispatch semaphore.
DispatchSemaphoreGuard
Dispatch semaphore guard.
DispatchSource
Dispatch source.
DispatchTime
An abstract representation of time.
DispatchWorkloop
Dispatch workloop queue.
MainThreadBound
Make a type that can only be used on the main thread be Send + Sync.
dispatch_source_mach_recv_flags_t
Mach receive-right flags.
dispatch_source_mach_send_flags_t
Mach send-right flags.
dispatch_source_memorypressure_flags_t
dispatch_source_proc_flags_t
Events related to a process.
dispatch_source_timer_flags_t
Flags to use when configuring a timer dispatch source.
dispatch_source_type_s
dispatch_source_vnode_flags_t
Events involving a change to a file system object.

Enums§

GlobalQueueIdentifier
Global queue identifier definition for DispatchQueue::new and DispatchQueue::new_with_target.
QualityOfServiceClassFloorError
Error returned by DispatchObject::set_qos_class_floor.
QueueAfterError
Error returned by DispatchQueue::after.
WaitError
Wait error.

Constants§

DISPATCH_API_VERSION
Apple’s documentation
QOS_MIN_RELATIVE_PRIORITY

Statics§

_dispatch_data_destructor_free
Apple’s documentation
_dispatch_data_destructor_munmap
Apple’s documentation
_dispatch_source_type_data_add
Apple’s documentation
_dispatch_source_type_data_or
Apple’s documentation
_dispatch_source_type_data_replace
Apple’s documentation
_dispatch_source_type_mach_recv
Apple’s documentation
_dispatch_source_type_mach_send
Apple’s documentation
_dispatch_source_type_memorypressure
Apple’s documentation
_dispatch_source_type_proc
Apple’s documentation
_dispatch_source_type_read
Apple’s documentation
_dispatch_source_type_signal
Apple’s documentation
_dispatch_source_type_timer
Apple’s documentation
_dispatch_source_type_vnode
Apple’s documentation
_dispatch_source_type_write
Apple’s documentation

Traits§

DispatchObject
Types that represent dispatch objects.

Functions§

dispatch_allow_send_signals
dispatch_block_cancel
Asynchronously cancel the specified dispatch block object.
dispatch_block_create
Create a new dispatch block object on the heap from an existing block and the given flags.
dispatch_block_create_with_qos_class
Create a new dispatch block object on the heap from an existing block and the given flags, and assign it the specified QOS class and relative priority.
dispatch_block_notify
Schedule a notification block to be submitted to a queue when the execution of a specified dispatch block object has completed.
dispatch_block_perform
Create, synchronously execute and release a dispatch block object from the specified block and flags.
dispatch_block_testcancel
Tests whether the given dispatch block object has been canceled.
dispatch_block_wait
Wait synchronously until execution of the specified dispatch block object has completed or until the specified timeout has elapsed.
dispatch_get_specific
Returns the current subsystem-specific context for a key unique to the subsystem.
dispatch_main
Executes blocks submitted to the main queue.
dispatch_read
Schedule a read operation for asynchronous execution on the specified file descriptor. The specified handler is enqueued with the data read from the file descriptor when the operation has completed or an error occurs.
dispatch_write
Schedule a write operation for asynchronous execution on the specified file descriptor. The specified handler is enqueued when the operation has completed or an error occurs.
run_on_main
Submit the given closure to the runloop on the main thread.

Type Aliases§

GroupDeprecated
Deprecated alias for DispatchGroup.
OnceDeprecated
Deprecated alias for DispatchOnce.
QueueDeprecated
Deprecated alias for DispatchQueue.
SemaphoreDeprecated
Deprecated alias for DispatchSemaphore.
WorkloopQueueDeprecated
Deprecated alias for DispatchWorkloop.
dispatch_block_t
The type of blocks submitted to dispatch queues, which take no arguments and have no return value.
dispatch_data_applier_t
A block to be invoked for every contiguous memory region in a data object.
dispatch_fd_t
Apple’s documentation
dispatch_function_t
The prototype of functions submitted to dispatch queues.
dispatch_io_handler_t
The prototype of I/O handler blocks for dispatch I/O operations.
dispatch_once_t
A predicate for use with dispatch_once(). It must be initialized to zero. Note: static and global variables default to zero.
dispatch_source_type_t