Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AtomicU64 for head/tail index in deque, channel, and queues #777

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Jan 23, 2022

Part of #433.

Comment on lines +64 to +91
#[cfg(not(crossbeam_no_atomic_64))]
pub(crate) use core::sync::atomic::AtomicU64;

#[cfg(crossbeam_no_atomic_64)]
#[derive(Debug)]
#[repr(transparent)]
pub(crate) struct AtomicU64 {
inner: crossbeam_utils::atomic::AtomicCell<u64>,
}

#[cfg(crossbeam_no_atomic_64)]
impl AtomicU64 {
pub(crate) const fn new(v: u64) -> Self {
Self {
inner: crossbeam_utils::atomic::AtomicCell::new(v),
}
}
pub(crate) fn load(&self, _order: Ordering) -> u64 {
self.inner.load()
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it preferable to define this in crossbeam_utils::atomic?

@taiki-e taiki-e marked this pull request as draft January 23, 2022 13:52
@taiki-e taiki-e force-pushed the atomic-64 branch 2 times, most recently from 9f4f0c1 to 2a94555 Compare January 23, 2022 14:17
@taiki-e taiki-e added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crossbeam-channel crossbeam-deque crossbeam-queue S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author
Development

Successfully merging this pull request may close these issues.

None yet

1 participant