about summary refs log tree commit diff
path: root/src/libcore/sync
AgeCommit message (Collapse)AuthorLines
2019-01-30Add suggestions to deprecation lintsOliver Scherer-2/+31
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-3/+2
2019-01-25std: Stabilize fixed-width integer atomicsAlex Crichton-55/+96
This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in #56753 and tracked in #32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes #32976 Closes #56753
2019-01-15Move spin_loop_hint to core::hint moduleClar Fon-9/+3
2018-12-25Remove licensesMark Rousskov-20/+0
2018-12-19Rollup merge of #56881 - Amanieu:ordering_eq, r=alexcrichtonPietro Albini-1/+1
Implement Eq, PartialEq and Hash for atomic::Ordering r? @alexcrichton
2018-12-16Implement Eq, PartialEq and Hash for atomic::OrderingAmanieu d'Antras-1/+1
2018-12-16Rollup merge of #53506 - phungleson:fix-from-docs-atomic, r=KodrAusMazdak Farrokhzad-2/+15
Documentation for impl From for AtomicBool and other Atomic types As part of issue #51430 (cc @skade). The impl is very simple, so not sure if we need to go into any details.
2018-12-12Bump to 1.33.0Alex Crichton-2/+2
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-12Documentation for impl From for AtomicBool and other Atomic typesSon-2/+15
2018-11-18atomic::Ordering: Get rid of misleading parts of introMichal 'vorner' Vaner-7/+9
Remove the parts of atomic::Ordering's intro that wrongly claimed that SeqCst prevents all reorderings around it. Closes #55196
2018-11-05Do not Atomic{I,U}128 in stage0Simonas Kazlauskas-2/+2
2018-10-27Make the Atomic types repr(C) to ensure newtypeSimonas Kazlauskas-5/+5
2018-10-27Correct alignment of atomic types and (re)add Atomic{I,U}128Oliver Middleton-0/+56
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
2018-09-24std: Start implementing wasm32 atomicsAlex Crichton-0/+8
This commit is an initial start at implementing the standard library for wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of these changes will be visible to users of the wasm32-unknown-unknown target because they all require recompiling the standard library. The hope with this is that we can get this support into the standard library and start iterating on it in-tree to enable experimentation. Currently there's a few components in this PR: * Atomic fences are disabled on wasm as there's no corresponding atomic op and it's not clear yet what the convention should be, but this will change in the future! * Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on the atomic intrinsics that wasm has. * The `ReentrantMutex` and thread-local-storage implementations panic currently as there's no great way to get a handle on the current thread's "id" yet. Right now the wasm32 target with atomics is unfortunately pretty unusable, requiring a lot of manual things here and there to actually get it operational. This will likely continue to evolve as the story for atomics and wasm unfolds, but we also need more LLVM support for some operations like custom `global` directives for this to work best.
2018-09-16remove (more) CAS API from Atomic* types where not natively supportedJorge Aparicio-0/+23
closes #54276
2018-09-05Remove `#[repr(transparent)]` from atomicsAlex Crichton-3/+0
Added in #52149 the discussion in #53514 is showing how we may not want to actually add this attribute to the atomic types. While we continue to debate #53514 this commit reverts the addition of the `transparent` attribute. This should be a more conservative route which leaves us the ability to tweak this in the future but in the meantime allows us to continue discussion as well.
2018-08-15Make core::sync::atomic::Ordering #[non_exhaustive]varkor-24/+1
2018-08-07document mode possibilities for all RMW operationsRalf Jung-29/+226
2018-08-07list possible orderings for load and storeRalf Jung-26/+43
2018-08-07forgot to add comment for some atomic typesRalf Jung-2/+4
2018-08-07fix link label; use more httpsRalf Jung-14/+14
2018-08-06atomic ordering docsRalf Jung-11/+48
2018-08-01Switch to bootstrapping from 1.29 betaMark Rousskov-16/+16
2018-07-07Add #[repr(transparent)] to Atomic* typeswillmo-0/+3
This allows them to be used in #[repr(C)] structs without warnings. Since rust-lang/rfcs#1649 and rust-lang/rust#35603 they are already documented to have "the same in-memory representation as" their corresponding primitive types. This just makes that explicit.
2018-07-05#[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")]Jorge Aparicio-16/+16
2018-07-05enable Atomic*.{load,store} for ARMv6-M / MSP430Jorge Aparicio-0/+16
closes #45085 this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M.
2018-04-19Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichtonbors-5/+3
atomic: remove 'Atomic*' from Debug output For the same reason that we don't show `Vec { data: [0, 1, 2, 3] }`, but just the array, the `AtomicUsize(1000)` is noisy, and seeing just `1000` is likely better.
2018-04-16Auto merge of #49963 - llogiq:stabilize-13226, r=kennytmbors-12/+11
stabilize fetch_nand This closes #13226 and makes `Atomic*.fetch_nand` stable.
2018-04-14stabilize fetch_nandAndre Bogus-12/+11
2018-04-12improve Atomic*::fetch_update docsAndre Bogus-2/+2
2018-04-05Rollup merge of #48658 - llogiq:no-more-cas, r=kennytmkennytm-0/+185
Add a generic CAS loop to std::sync::Atomic* This adds two new methods to both `AtomicIsize` and `AtomicUsize` with optimized safe compare-and-set loops, so users will no longer need to write their own, except in *very* strange circumstances. `update_and_fetch` will apply the function and return its result, whereas `fetch_and_update` will apply the function and return the previous value. This solves #48384 with `x.update_and_fetch(|x| x.max(y))`. It also relates to #48655 (which I misuse as tracking issue for now).. *note* This *might* need a crater run because the functions could clash with third party extension traits.
2018-03-30Add a generic CAS loop to std::sync::Atomic*Andre Bogus-0/+185
This adds a new method to all numeric `Atomic*` types with a safe compare-and-set loop, so users will no longer need to write their own, except in *very* strange circumstances. This solves #48384 with `x.fetch_max(_)`/`x.fetch_min(_)`. It also relates to #48655 (which I misuse as tracking issue for now). *note* This *might* need a crater run because the functions could clash with third party extension traits.
2018-03-26Rollup merge of #49170 - steveklabnik:gh49127, r=nagisaTim Neumann-2/+5
Clarify AcqRel's docs This implied things that are not true. Fixes #49127
2018-03-25update wording as per feedbackSteve Klabnik-1/+3
2018-03-19Make Atomic doc examples specific to each typeGuillaume Gomez-364/+401
2018-03-19Clarify AcqRel's docssteveklabnik-2/+3
This implied things that are not true. Fixes #49127
2018-02-26atomic: remove 'Atomic*' from Debug outputSean McArthur-5/+3
2018-02-16Force the link to std::thread::yield_now()Stefan Schindler-1/+1
2018-02-16Add link to yield_nowStefan Schindler-3/+4
2018-02-09Add fetch_nand.Mark Simulacrum-0/+46
cc #13226 (the tracking issue)
2018-01-28Auto merge of #47204 - varkor:unsafecell-into_inner-safe, r=alexcrichtonbors-3/+3
Make UnsafeCell::into_inner safe This fixes #35067. It will require a Crater run as discussed in that issue.
2018-01-05Make UnsafeCell::into_inner safevarkor-3/+3
This fixes #35067. It will require a Crater run as discussed in that issue.
2017-12-27Correct a few stability attributesOliver Middleton-1/+12
2017-12-10Add `std::fmt::Pointer` implementation for `AtomicPtr`varkor-0/+8
Resolves #29212.
2017-11-29Rollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushikennytm-0/+7
impl From<bool> for AtomicBool This seems like an obvious omission from #45610. ~~I've used the same feature name and version in the hope that this can be backported to beta so it's stabilized with the other impls. If it can't be I'll change it to `1.24.0`.~~
2017-11-29Rollup merge of #46287 - SimonSapin:stable-constness, r=aturonkennytm-14/+1
Stabilize const-calling existing const-fns in std Fixes #46038
2017-11-27Change version number for `impl From<bool> for AtomicBool` to 1.24.0Oliver Middleton-1/+1
2017-11-27Change the stabilization version to 1.24.0Stjepan Glavina-1/+1
2017-11-27impl From<bool> for AtomicBoolOliver Middleton-0/+7