dispatch2
Bindings and wrappers for Apple's Grand Central Dispatch (GCD)
0.3.1
54M downloads/mo
#1173 most downloaded on crates.io
madsmtm/objc2
What this package is like to depend on
Last release 5 months ago
26 Feb 2026
Release timing varies
gaps range from 3 months to 2.3 years
Nearly every release is documented
notes for 4 of 4 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
4 releases · first in 2022
1 release in the last 12 months
see the full history below
Release timeline
4 releases · Oct 2022 to Feb 2026Releases
latest 4-
0.3.126 Feb 2026Release notes
Open source →Fixed
- Fixed reference counting in
DispatchSemaphoreGuard::release. - Inlined more functions. This should allow using this library on macOS 10.12 with
crate-type = ["dylib"].
- Fixed reference counting in
-
0.3.019 Apr 2025Release notes
Open source →Added
- Allow
Queue::exec_syncon workloops. This is discouraged for performance reasons, but doesn't need to be outright disallowed. - Added
DispatchRetained<T>, which is a smart pointer which allows retain/release operations on dispatch objects, similar in spirit toobjc2::rc::Retained. This mostly replacesDispatchObject<T>. - Implement
SendandSyncfor dispatch objects. - Added
DispatchDatahelper functions.
Changed
-
Changed how memory management works to match other
objc2crates. Instead of types likeDispatchGroupholding the retain count internally, it is now done externally byDispatchRetained<DispatchGroup>. -
Converted
DispatchObjectto a trait. -
BREAKING: Renamed dispatch types to be prefixed with
Dispatch(e.g.DispatchGroup,DispatchQueueandDispatchOnce).Some of the old names are kept (but deprecated) for easier migration.
-
Handle memory management in
ffimodule automatically. -
Merged some high-level binding types with their
ffi"_t"/"_s" counterparts. E.g.dispatch_group_t,dispatch_group_sandDispatchGroupare now one type. -
Move some functions to methods on the relevant Dispatch type.
Removed
-
BREAKING: Removed
TargetQueueErrorand the error case inDispatchObject::set_target_queue(it now instead aborts on error, as that's what the underlying function does). -
Removed
ffimethods that are actually macros:dispatch_waitdispatch_notifydispatch_canceldispatch_testcancel
Using these would have resulted in a linker error before.
- BREAKING: Removed direct access to most modules. Instead, types are publicly exported in the root.
- Allow
-
0.2.023 Jan 2025Release notes
Open source →Added
- Added support for
objc2encodings. - Added initial support for
block2. - Autogenerated
ffibindings, which adds:dispatch_data_applier_t.dispatch_fd_t.dispatch_io_close_flags_t.dispatch_io_handler_t.dispatch_io_interval_flags_t.dispatch_io_s/dispatch_io_t.dispatch_io_type_t.DISPATCH_WALLTIME_NOW._dispatch_source_type_mach_recv._dispatch_source_type_proc._dispatch_source_type_signal._dispatch_source_type_vnode.dispatch_allow_send_signals.dispatch_apply.dispatch_cancel.dispatch_data_apply.dispatch_get_current_queueDeprecated.dispatch_get_main_queue.dispatch_io_barrier.dispatch_io_close.dispatch_io_create.dispatch_io_create_with_io.dispatch_io_create_with_path.dispatch_io_get_descriptor.dispatch_io_read.dispatch_io_set_high_water.dispatch_io_set_interval.dispatch_io_set_low_water.dispatch_io_write.dispatch_notify.dispatch_read.dispatch_testcancel.dispatch_wait.dispatch_write.
- Added
#[must_use]in bindings where the source uses it. - Added
Queue::mainfor fetching the main queue. - Moved
run_on_mainandMainThreadBoundfromobjc2-foundationto this crate. - Added
Once, a wrapper overdispatch_once_fwhich works similarly tostd::sync::Once. - Added
#![no_std]support
Changed
- Moved to the
objc2project. - BREAKING: Made
Queue::set_specifictake a key pointer instead of ausize.
Fixed
- BREAKING: Use
extern "C-unwind"instead ofextern "C"in certain functions that required that. - BREAKING: Use
isizeinstead ofusizein certain functions where that is more correct. - BREAKING: An
F: 'staticbound was added to the following methods to make sure any referenced values passed to them are borrowed for long enough since they perform theirworkasynchronously (#689):Group::exec_asyncQueue::exec_asyncQueue::barrier_asyncQueue::barrier_async_and_wait
- Added support for
-
0.1.001 Oct 2022