pub struct SBQueue {
pub raw: SBQueueRef,
}
Expand description
A libdispatch
(aka Grand Central Dispatch) queue.
A program using libdispatch
will create queues, put work items
(functions, blocks) on the queues. The system will create /
reassign pthreads to execute the work items for the queues. A
serial queue will be associated with a single thread (or possibly
no thread, if it is not doing any work). A concurrent queue may
be associated with multiple threads.
The available queues within a process can be found discovered by
inspecting the process
:
// Iterate over the queues...
for queue in process.queues() {
println!("Hello {}!", queue.queue_id());
}
If a queue is associated with a thread, it can be discovered
from the thread via SBThread::queue()
.
Fields
raw: SBQueueRef
The underlying raw SBQueueRef
.
Implementations
sourceimpl SBQueue
impl SBQueue
pub fn process(&self) -> SBProcess
sourcepub fn queue_id(&self) -> u64
pub fn queue_id(&self) -> u64
Returns a unique identifying number for this queue that will not be used by any other queue during this process’ execution.
These ID numbers often start at 1 with the first system-created queues and increment from there.
sourcepub fn threads(&self) -> SBQueueThreadIter<'_>ⓘNotable traits for SBQueueThreadIter<'d>impl<'d> Iterator for SBQueueThreadIter<'d> type Item = SBThread;
pub fn threads(&self) -> SBQueueThreadIter<'_>ⓘNotable traits for SBQueueThreadIter<'d>impl<'d> Iterator for SBQueueThreadIter<'d> type Item = SBThread;
Get an iterator over the threads associated with this queue.
sourcepub fn pending_items(&self) -> SBQueueQueueItemIter<'_>ⓘNotable traits for SBQueueQueueItemIter<'d>impl<'d> Iterator for SBQueueQueueItemIter<'d> type Item = SBQueueItem;
pub fn pending_items(&self) -> SBQueueQueueItemIter<'_>ⓘNotable traits for SBQueueQueueItemIter<'d>impl<'d> Iterator for SBQueueQueueItemIter<'d> type Item = SBQueueItem;
Get an iterator over the pending items known to this queue.
sourcepub fn num_running_items(&self) -> u32
pub fn num_running_items(&self) -> u32
The number of work items that this queue is currently running.
For a serial queue, this will be 0
or 1
. For a concurrent
queue, this may be any number.