summary refs log tree commit diff
path: root/src/libcore/sync
AgeCommit message (Collapse)AuthorLines
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
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-14/+1
Fixes #46038
2017-11-22Stabilize spin_loop_hintStjepan Glavina-3/+2
2017-11-09fix core for targets with max-atomic-width = 0Jorge Aparicio-0/+1
closes #45802
2017-10-31since = "1.23.0"M Farkas-Dyck-2/+2
2017-10-29feature = "atomic_from"M Farkas-Dyck-2/+2
2017-10-29impl From<T> for AtomicTM Farkas-Dyck-0/+12
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-3/+3
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-05Add missing links for AtomicBoolGuillaume Gomez-5/+12
2017-09-29Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnikMark Simulacrum-1/+25
docs improvement sync::atomic::Atomic* Addresses the `Atomic*` part of #29377. r? @steveklabnik
2017-09-25docs improvement sync::atomic::Atomic*Lucas Morales-1/+25
2017-09-24Backport libs stabilizations to 1.21 betaDavid Tolnay-1/+1
This includes the following stabilizations: - tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563 - iterator_for_each https://github.com/rust-lang/rust/pull/44567 - ord_max_min https://github.com/rust-lang/rust/pull/44593 - compiler_fences https://github.com/rust-lang/rust/pull/44595 - needs_drop https://github.com/rust-lang/rust/pull/44639 - vec_splice https://github.com/rust-lang/rust/pull/44640
2017-09-16Added more text from unstable-book to `compiler_fence` docsMichal Budzynski-4/+19
2017-09-16Added example to `compiler_fence` docs taken from unstable-bookMichal Budzynski-0/+34
2017-09-16stabilized compiler_fences (fixes #41091)Michal Budzynski-1/+1