pub unsafe extern "C" fn dispatch_block_wait(
block: dispatch_block_t,
timeout: DispatchTime,
) -> isizeExpand description
Wait synchronously until execution of the specified dispatch block object has completed or until the specified timeout has elapsed.
This function will return immediately if execution of the block object has already completed.
It is not possible to wait for multiple executions of the same block object with this interface; use dispatch_group_wait() for that purpose. A single dispatch block object may either be waited on once and executed once, or it may be executed any number of times. The behavior of any other combination is undefined. Submission to a dispatch queue counts as an execution, even if cancellation (dispatch_block_cancel) means the block’s code never runs.
The result of calling this function from multiple threads simultaneously with the same dispatch block object is undefined, but note that doing so would violate the rules described in the previous paragraph.
If this function returns indicating that the specified timeout has elapsed, then that invocation does not count as the one allowed wait.
If at the time this function is called, the specified dispatch block object has been submitted directly to a serial queue, the system will make a best effort to apply the necessary QOS overrides to ensure that the block and any blocks submitted earlier to that serial queue are executed at the QOS class (or higher) of the thread calling dispatch_block_wait().
Parameter block: The dispatch block object to wait on.
The result of passing NULL or a block object not returned by one of the
dispatch_block_create* functions is undefined.
Parameter timeout: When to timeout (see dispatch_time). As a convenience, there are the
DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
Returns: Returns zero on success (the dispatch block object completed within the specified timeout) or non-zero on error (i.e. timed out).