Skip to content

Commit

Permalink
Add DispatchObject::_retain
Browse files Browse the repository at this point in the history
  • Loading branch information
nvzqz committed Sep 19, 2020
1 parent 0e83180 commit 1e7236f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/dispatch/object.rs
Expand Up @@ -30,10 +30,7 @@ impl Drop for DispatchObject {
impl Clone for DispatchObject {
#[inline]
fn clone(&self) -> Self {
extern "C" {
fn dispatch_retain(obj: dispatch_object_t);
}
unsafe { dispatch_retain(self.0) };
self._retain();
Self(self.0)
}
}
Expand Down Expand Up @@ -73,6 +70,14 @@ impl DispatchObject {
Self(ptr.cast())
}

#[inline]
pub(crate) fn _retain(&self) {
extern "C" {
fn dispatch_retain(obj: dispatch_object_t);
}
unsafe { dispatch_retain(self.0) };
}

/// Casts `self` to a raw nullable pointer.
#[inline]
pub fn as_ptr(&self) -> *mut c_void {
Expand Down

0 comments on commit 1e7236f

Please sign in to comment.