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
via SBProcess::queues()
:
// 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§
Source§impl 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<'_> ⓘ
pub fn threads(&self) -> SBQueueThreadIter<'_> ⓘ
Get an iterator over the threads associated with this queue.
Sourcepub fn pending_items(&self) -> SBQueueQueueItemIter<'_> ⓘ
pub fn pending_items(&self) -> SBQueueQueueItemIter<'_> ⓘ
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.