DispatchGroup

Struct DispatchGroup 

Source
#[repr(C)]
pub struct DispatchGroup { /* private fields */ }
Expand description

Dispatch group.

Implementations§

Source§

impl DispatchGroup

Source

pub fn new() -> DispatchRetained<DispatchGroup>

Creates new group with which blocks may be associated.

This function creates a new group with which blocks may be associated. The dispatch group may be used to wait for the completion of the blocks it references. The group object memory is freed with dispatch_release().

Returns: The newly created group, or NULL on failure.

Source

pub unsafe fn exec_async_with_block( self: &DispatchGroup, queue: &DispatchQueue, block: dispatch_block_t, )

Source

pub unsafe fn exec_async_f( self: &DispatchGroup, queue: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )

Submits a function to a dispatch queue and associates the block with the given dispatch group.

See dispatch_group_async() for details.

Parameter group: A dispatch group to associate with the submitted function. The result of passing NULL in this parameter is undefined.

Parameter queue: The dispatch queue to which the function will be submitted for asynchronous invocation.

Parameter context: The application-defined context parameter to pass to the function.

Parameter work: The application-defined function to invoke on the target queue. The first parameter passed to this function is the context provided to dispatch_group_async_f().

Source§

impl DispatchGroup

Source

pub unsafe fn notify_with_block( self: &DispatchGroup, queue: &DispatchQueue, block: dispatch_block_t, )

Source

pub unsafe fn notify_f( self: &DispatchGroup, queue: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )

Schedule a function to be submitted to a queue when all the blocks associated with a group have completed.

See dispatch_group_notify() for details.

Parameter group: The dispatch group to observe. The result of passing NULL in this parameter is undefined.

Parameter context: The application-defined context parameter to pass to the function.

Parameter work: The application-defined function to invoke on the target queue. The first parameter passed to this function is the context provided to dispatch_group_notify_f().

Source§

impl DispatchGroup

Source

pub unsafe fn leave(self: &DispatchGroup)

Manually indicate a block in the group has completed

Calling this function indicates block has completed and left the dispatch group by a means other than dispatch_group_async().

Parameter group: The dispatch group to update. The result of passing NULL in this parameter is undefined.

Source§

impl DispatchGroup

Source

pub fn exec_async<F>(&self, queue: &DispatchQueue, work: F)
where F: Send + FnOnce() + 'static,

Submit a function to a DispatchQueue and associates it with the DispatchGroup.

Source

pub fn wait(&self, timeout: DispatchTime) -> Result<(), WaitError>

Wait synchronously for the previously submitted functions to finish.

§Errors

Return WaitError::Timeout in case of timeout.

Source

pub fn notify<F>(&self, queue: &DispatchQueue, work: F)
where F: Send + FnOnce(),

Schedule a function to be submitted to a DispatchQueue when a group of previously submitted functions have completed.

Source

pub fn enter(&self) -> DispatchGroupGuard

Explicitly indicates that the function has entered the DispatchGroup.

Trait Implementations§

Source§

impl AsRef<AnyObject> for DispatchGroup

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<DispatchGroup> for DispatchGroup

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for DispatchGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DispatchObject for DispatchGroup

Source§

fn retain(&self) -> DispatchRetained<Self>

Increment the reference count of the object. Read more
Source§

fn context(&self) -> *mut c_void

TODO. Read more
Source§

unsafe fn set_context(&self, context: *mut c_void)

TODO. Read more
Source§

unsafe fn set_finalizer_f(&self, finalizer: dispatch_function_t)

TODO. Read more
Source§

fn set_finalizer<F>(&self, destructor: F)
where F: Send + FnOnce(),

Set the finalizer function for the object.
Source§

unsafe fn set_target_queue(&self, queue: &DispatchQueue)

Set the target DispatchQueue of this object. Read more
Source§

unsafe fn set_qos_class_floor( &self, qos_class: DispatchQoS, relative_priority: i32, ) -> Result<(), QualityOfServiceClassFloorError>

Set the QOS class floor on a dispatch queue, source or workloop. Read more
Source§

fn activate(&self)

Activate the object.
Source§

fn suspend(&self)

Suspend the invocation of functions on the object.
Source§

fn resume(&self)

Resume the invocation of functions on the object.
Source§

impl Hash for DispatchGroup

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for DispatchGroup

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl PartialEq for DispatchGroup

Source§

fn eq(&self, other: &Self) -> bool

Compare this [$type] with another using pointer equality.

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for DispatchGroup

Source§

const ENCODING_REF: Encoding = objc2::encode::Encoding::Object

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl Eq for DispatchGroup

Source§

impl Send for DispatchGroup

Source§

impl Sync for DispatchGroup

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,