#[repr(C)]pub struct DispatchWorkloop { /* private fields */ }
Expand description
Dispatch workloop queue.
Implementations§
Source§impl DispatchWorkloop
impl DispatchWorkloop
Sourcepub fn set_autorelease_frequency(
self: &DispatchWorkloop,
frequency: DispatchAutoReleaseFrequency,
)
pub fn set_autorelease_frequency( self: &DispatchWorkloop, frequency: DispatchAutoReleaseFrequency, )
Sets the autorelease frequency of the workloop.
See dispatch_queue_attr_make_with_autorelease_frequency(). The default policy for a workloop is DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM.
Parameter workloop
: The dispatch workloop to modify.
This workloop must be inactive, passing an activated object is undefined and will cause the process to be terminated.
Parameter frequency
: The requested autorelease frequency.
Source§impl DispatchWorkloop
impl DispatchWorkloop
Sourcepub fn new(label: &str, inactive: bool) -> DispatchRetained<Self> ⓘ
pub fn new(label: &str, inactive: bool) -> DispatchRetained<Self> ⓘ
Create a new DispatchWorkloop
.
Methods from Deref<Target = DispatchQueue>§
pub unsafe fn exec_async_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn exec_async_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn exec_async_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a function for asynchronous execution on a dispatch queue.
See dispatch_async() for details.
Parameter queue
: The target dispatch queue to which the function is submitted.
The system will hold a reference on the target queue until the function
has returned.
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_async_f().
The result of passing NULL in this parameter is undefined.
pub unsafe fn exec_sync_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn exec_sync_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn exec_sync_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a function for synchronous execution on a dispatch queue.
See dispatch_sync() for details.
Parameter queue
: The target dispatch queue to which the function is submitted.
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_sync_f().
The result of passing NULL in this parameter is undefined.
pub unsafe fn exec_sync_and_wait_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn exec_sync_and_wait_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn exec_sync_and_wait_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a function for synchronous execution on a dispatch queue.
See dispatch_async_and_wait() for details.
Parameter queue
: The target dispatch queue to which the function is submitted.
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_async_and_wait_f().
The result of passing NULL in this parameter is undefined.
Sourcepub unsafe fn qos_class(
self: &DispatchQueue,
relative_priority_ptr: *mut c_int,
) -> DispatchQoS
pub unsafe fn qos_class( self: &DispatchQueue, relative_priority_ptr: *mut c_int, ) -> DispatchQoS
Returns the QOS class and relative priority of the given queue.
If the given queue was created with an attribute value returned from dispatch_queue_attr_make_with_qos_class(), this function returns the QOS class and relative priority specified at that time; for any other attribute value it returns a QOS class of QOS_CLASS_UNSPECIFIED and a relative priority of 0.
If the given queue is one of the global queues, this function returns its assigned QOS class value as documented under dispatch_get_global_queue() and a relative priority of 0; in the case of the main queue it returns the QOS value provided by qos_class_main() and a relative priority of 0.
Parameter queue
: The queue to query.
Parameter relative_priority_ptr
: A pointer to an int variable to be filled with the relative priority offset
within the QOS class, or NULL.
Returns: A QOS class value:
- QOS_CLASS_USER_INTERACTIVE
- QOS_CLASS_USER_INITIATED
- QOS_CLASS_DEFAULT
- QOS_CLASS_UTILITY
- QOS_CLASS_BACKGROUND
- QOS_CLASS_UNSPECIFIED
pub unsafe fn barrier_async_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn barrier_async_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn barrier_async_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a barrier function for asynchronous execution on a dispatch queue.
Submits a function to a dispatch queue like dispatch_async_f(), but marks that function as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
See dispatch_async_f() for details and “Dispatch Barrier API” for a description of the barrier semantics.
Parameter queue
: The target dispatch queue to which the function is submitted.
The system will hold a reference on the target queue until the function
has returned.
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_barrier_async_f().
The result of passing NULL in this parameter is undefined.
pub unsafe fn barrier_sync_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn barrier_sync_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn barrier_sync_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a barrier function for synchronous execution on a dispatch queue.
Submits a function to a dispatch queue like dispatch_sync_f(), but marks that fuction as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
See dispatch_sync_f() for details.
Parameter queue
: The target dispatch queue to which the function is submitted.
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_barrier_sync_f().
The result of passing NULL in this parameter is undefined.
pub unsafe fn barrier_async_and_wait_with_block( self: &DispatchQueue, block: dispatch_block_t, )
Sourcepub unsafe fn barrier_async_and_wait_f(
self: &DispatchQueue,
context: *mut c_void,
work: dispatch_function_t,
)
pub unsafe fn barrier_async_and_wait_f( self: &DispatchQueue, context: *mut c_void, work: dispatch_function_t, )
Submits a function for synchronous execution on a dispatch queue.
Submits a function to a dispatch queue like dispatch_async_and_wait_f(), but marks that function as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
See “Dispatch Barrier API” for a description of the barrier semantics.
Parameter queue
: The target dispatch queue to which the function is submitted.
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_barrier_async_and_wait_f().
The result of passing NULL in this parameter is undefined.
Sourcepub unsafe fn specific(
self: &DispatchQueue,
key: NonNull<c_void>,
) -> *mut c_void
pub unsafe fn specific( self: &DispatchQueue, key: NonNull<c_void>, ) -> *mut c_void
Returns the subsystem-specific context associated with a dispatch queue, for a key unique to the subsystem.
Returns the context for the specified key if it has been set on the specified queue.
Parameter queue
: The dispatch queue to query.
The result of passing NULL in this parameter is undefined.
Parameter key
: The key to get the context for, typically a pointer to a static variable
specific to the subsystem. Keys are only compared as pointers and never
dereferenced. Passing a string constant directly is not recommended.
Returns: The context for the specified key or NULL if no context was found.
Sourcepub fn assert(self: &DispatchQueue)
pub fn assert(self: &DispatchQueue)
Verifies that the current block is executing on a given dispatch queue.
Some code expects to be run on a specific dispatch queue. This function verifies that that expectation is true.
If the currently executing block was submitted to the specified queue or to any queue targeting it (see dispatch_set_target_queue()), this function returns.
If the currently executing block was submitted with a synchronous API (dispatch_sync(), dispatch_barrier_sync(), …), the context of the submitting block is also evaluated (recursively). If a synchronously submitting block is found that was itself submitted to the specified queue or to any queue targeting it, this function returns.
Otherwise this function asserts: it logs an explanation to the system log and terminates the application.
Passing the result of dispatch_get_main_queue() to this function verifies that the current block was submitted to the main queue, or to a queue targeting it, or is running on the main thread (in any context).
When dispatch_assert_queue() is called outside of the context of a submitted block (for example from the context of a thread created manually with pthread_create()) then this function will also assert and terminate the application.
The variant dispatch_assert_queue_debug() is compiled out when the preprocessor macro NDEBUG is defined. (See also assert(3)).
Parameter queue
: The dispatch queue that the current block is expected to run on.
The result of passing NULL in this parameter is undefined.
Sourcepub fn assert_barrier(self: &DispatchQueue)
pub fn assert_barrier(self: &DispatchQueue)
Verifies that the current block is executing on a given dispatch queue, and that the block acts as a barrier on that queue.
This behaves exactly like dispatch_assert_queue(), with the additional check that the current block acts as a barrier on the specified queue, which is always true if the specified queue is serial (see DISPATCH_BLOCK_BARRIER or dispatch_barrier_async() for details).
The variant dispatch_assert_queue_barrier_debug() is compiled out when the preprocessor macro NDEBUG is defined. (See also assert()).
Parameter queue
: The dispatch queue that the current block is expected to run as a barrier on.
The result of passing NULL in this parameter is undefined.
Sourcepub fn assert_not(self: &DispatchQueue)
pub fn assert_not(self: &DispatchQueue)
Verifies that the current block is not executing on a given dispatch queue.
This function is the equivalent of dispatch_assert_queue() with the test for equality inverted. That means that it will terminate the application when dispatch_assert_queue() would return, and vice-versa. See discussion there.
The variant dispatch_assert_queue_not_debug() is compiled out when the preprocessor macro NDEBUG is defined. (See also assert(3)).
Parameter queue
: The dispatch queue that the current block is expected not to run on.
The result of passing NULL in this parameter is undefined.
pub const APPLY_AUTO: Option<&DispatchQueue> = None
pub const TARGET_QUEUE_DEFAULT: Option<&DispatchQueue> = None
pub const CURRENT_QUEUE_LABEL: Option<&DispatchQueue> = None
Sourcepub fn exec_sync<F>(&self, work: F)
pub fn exec_sync<F>(&self, work: F)
Submit a function for synchronous execution on the DispatchQueue
.
Sourcepub fn exec_async<F>(&self, work: F)
pub fn exec_async<F>(&self, work: F)
Submit a function for asynchronous execution on the DispatchQueue
.
Sourcepub fn after<F>(
&self,
when: DispatchTime,
work: F,
) -> Result<(), QueueAfterError>
pub fn after<F>( &self, when: DispatchTime, work: F, ) -> Result<(), QueueAfterError>
Enqueue a function for execution at the specified time on the DispatchQueue
.
Sourcepub fn barrier_async<F>(&self, work: F)
pub fn barrier_async<F>(&self, work: F)
Enqueue a barrier function for asynchronous execution on the DispatchQueue
and return immediately.
Sourcepub fn barrier_sync<F>(&self, work: F)
pub fn barrier_sync<F>(&self, work: F)
Enqueue a barrier function for synchronous execution on the DispatchQueue
and wait until that function completes.
Sourcepub fn barrier_async_and_wait<F>(&self, work: F)
pub fn barrier_async_and_wait<F>(&self, work: F)
Submit a function for synchronous execution and mark the function as a barrier for subsequent concurrent tasks.
Sourcepub fn set_specific<F>(&self, key: NonNull<()>, destructor: F)
pub fn set_specific<F>(&self, key: NonNull<()>, destructor: F)
Sets a function at the given key that will be executed at DispatchQueue
destruction.
Sourcepub fn set_qos_class_floor(
&self,
qos_class: DispatchQoS,
relative_priority: i32,
) -> Result<(), QualityOfServiceClassFloorError>
pub fn set_qos_class_floor( &self, qos_class: DispatchQoS, relative_priority: i32, ) -> Result<(), QualityOfServiceClassFloorError>
Set the QOS class floor of the DispatchQueue
.
Trait Implementations§
Source§impl AsRef<AnyObject> for DispatchWorkloop
impl AsRef<AnyObject> for DispatchWorkloop
Source§impl AsRef<DispatchQueue> for DispatchWorkloop
impl AsRef<DispatchQueue> for DispatchWorkloop
Source§fn as_ref(&self) -> &DispatchQueue
fn as_ref(&self) -> &DispatchQueue
Source§impl AsRef<DispatchWorkloop> for DispatchWorkloop
impl AsRef<DispatchWorkloop> for DispatchWorkloop
Source§impl Borrow<DispatchQueue> for DispatchWorkloop
impl Borrow<DispatchQueue> for DispatchWorkloop
Source§fn borrow(&self) -> &DispatchQueue
fn borrow(&self) -> &DispatchQueue
Source§impl Debug for DispatchWorkloop
impl Debug for DispatchWorkloop
Source§impl Deref for DispatchWorkloop
impl Deref for DispatchWorkloop
Source§fn deref(&self) -> &Self::Target
fn deref(&self) -> &Self::Target
Access the workloop as a DispatchQueue
.
Source§type Target = DispatchQueue
type Target = DispatchQueue
Source§impl DispatchObject for DispatchWorkloop
impl DispatchObject for DispatchWorkloop
Source§fn retain(&self) -> DispatchRetained<Self> ⓘ
fn retain(&self) -> DispatchRetained<Self> ⓘ
Source§unsafe fn set_finalizer_f(&self, finalizer: dispatch_function_t)
unsafe fn set_finalizer_f(&self, finalizer: dispatch_function_t)
Source§fn set_finalizer<F>(&self, destructor: F)
fn set_finalizer<F>(&self, destructor: F)
Source§unsafe fn set_target_queue(&self, queue: &DispatchQueue)
unsafe fn set_target_queue(&self, queue: &DispatchQueue)
DispatchQueue
of this object. Read more