Skip to content
Open
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
22 changes: 22 additions & 0 deletions crossbeam-deque/src/deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,28 @@ impl<T> Worker<T> {
}
}

/// Checks if the worker and the provided stealer are pointing to the same underlying queue.
///
/// # Examples
///
/// ```
/// use crossbeam_deque::Worker;
///
/// let w_1 = Worker::<i32>::new_lifo();
/// let w_2 = Worker::<i32>::new_fifo();
///
/// let s_1 = w_1.stealer();
/// let s_2 = w_2.stealer();
///
/// assert!(w_1.donates_to(&s_1));
/// assert!(w_2.donates_to(&s_2));
/// assert!(!w_1.donates_to(&s_2));
/// assert!(!w_2.donates_to(&s_1));
/// ```
pub fn donates_to(&self, stealer: &Stealer<T>) -> bool {
Arc::ptr_eq(&self.inner, &stealer.inner)
}

/// Resizes the internal buffer to the new capacity of `new_cap`.
#[cold]
unsafe fn resize(&self, new_cap: usize) {
Expand Down
Loading