Skip to content

Commit

Permalink
Merge #787
Browse files Browse the repository at this point in the history
787: Do not provide AtomicCell when cfg(crossbeam_loom) is enabled r=taiki-e a=taiki-e

We cannot provide AtomicCell under `cfg(crossbeam_loom)` because loom's atomic types have a different in-memory representation than the underlying type. (tokio-rs/loom#253)

https://github.com/crossbeam-rs/crossbeam/blob/bd83e1f2328e90298fc8a2f535a25d94ece09152/crossbeam-utils/src/atomic/atomic_cell.rs#L35-L42

fyi `@jonhoo` 

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e authored Feb 9, 2022
2 parents bd83e1f + 85eac6a commit 8ed251b
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 227 deletions.
14 changes: 1 addition & 13 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,7 @@ mod primitive {
pub(crate) mod sync {
pub(crate) mod atomic {
use core::sync::atomic::Ordering;
pub(crate) use loom::sync::atomic::AtomicUsize;
pub(crate) fn fence(ord: Ordering) {
if let Ordering::Acquire = ord {
} else {
// FIXME: loom only supports acquire fences at the moment.
// https://github.com/tokio-rs/loom/issues/117
// let's at least not panic...
// this may generate some false positives (`SeqCst` is stronger than `Acquire`
// for example), and some false negatives (`Relaxed` is weaker than `Acquire`),
// but it's the best we can do for the time being.
}
loom::sync::atomic::fence(Ordering::Acquire)
}
pub(crate) use loom::sync::atomic::{fence, AtomicUsize};

// FIXME: loom does not support compiler_fence at the moment.
// https://github.com/tokio-rs/loom/issues/117
Expand Down
Loading

0 comments on commit 8ed251b

Please # to comment.