Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::queue::Queue;
/// allows for aggregate synchronization, so you can track when all the
/// closures complete, even if they are running on different queues.
#[derive(Debug)]
#[repr(transparent)]
pub struct Group {
ptr: dispatch_group_t,
}
Expand Down Expand Up @@ -80,6 +81,11 @@ impl Group {
};
result == 0
}

/// Returns the raw underlying `dispatch_group_t` value.
pub fn as_raw(&self) -> dispatch_group_t {
self.ptr
}
}

unsafe impl Sync for Group { }
Expand Down
6 changes: 6 additions & 0 deletions src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl QueuePriority {
/// For more information, see Apple's [Grand Central Dispatch reference](
/// https://developer.apple.com/library/mac/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html).
#[derive(Debug)]
#[repr(transparent)]
pub struct Queue {
pub(crate) ptr: dispatch_queue_t,
}
Expand Down Expand Up @@ -281,6 +282,11 @@ impl Queue {
pub fn suspend(&self) -> SuspendGuard {
SuspendGuard::new(self)
}

/// Returns the raw underlying `dispatch_queue_t` value.
pub fn as_raw(&self) -> dispatch_queue_t {
self.ptr
}
}

unsafe impl Sync for Queue { }
Expand Down
6 changes: 6 additions & 0 deletions src/sem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{time_after_delay, WaitTimeout};

/// A counting semaphore.
#[derive(Debug)]
#[repr(transparent)]
pub struct Semaphore {
ptr: dispatch_semaphore_t,
}
Expand Down Expand Up @@ -69,6 +70,11 @@ impl Semaphore {
self.wait_timeout(timeout)?;
Ok(SemaphoreGuard::new(self.clone()))
}

/// Returns the raw underlying `dispatch_semaphore_t` value.
pub fn as_raw(&self) -> dispatch_semaphore_t {
self.ptr
}
}

unsafe impl Sync for Semaphore {}
Expand Down