Skip to content

Change compare_exchange to return a Result<T, T> #32244

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

Merged
merged 1 commit into from
Mar 19, 2016
Merged
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
24 changes: 20 additions & 4 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,35 @@ extern "rust-intrinsic" {
// NB: These intrinsics take raw pointers because they mutate aliased
// memory, which is not valid for either `&` or `&mut`.

#[cfg(stage0)]
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
#[cfg(stage0)]
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
#[cfg(stage0)]
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
#[cfg(stage0)]
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
#[cfg(stage0)]
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;

#[cfg(not(stage0))]
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
#[cfg(not(stage0))]
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> T;
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);

#[cfg(not(stage0))]
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
Expand Down
Loading