Commit Graph

145 Commits

Author SHA1 Message Date
Ralf Jung
a2b2362ce7 do not reference LLVM for our concurrency memory model 2019-10-12 16:23:39 +02:00
Tyler Mandry
05d93a7d06
Rollup merge of #64348 - arnohaase:pr_documentation_spin_loop_hint, r=alexcrichton
PR: documentation spin loop hint

The documentation for 'spin loop hint' explains that yield is better if the lock holder is running on the same CPU. I suggest that 'CPU or core' would be clearer.
2019-09-18 10:58:05 -07:00
Arno Haase
eb48b5d983 broken hyperlinks in documentation 2019-09-18 12:31:34 +02:00
Arno Haase
f4f136e67b newly phrased documentation for spin loop hints 2019-09-17 12:09:07 +02:00
Arno Haase
51c49e2573 fixed linter error 2019-09-10 14:25:40 +02:00
Arno Haase
7ad44c7c9c documentation for AtomicPtr CAS operations 2019-09-10 14:18:16 +02:00
Arno Haase
356b4c81a0 documentation enhancement for 'spin loop hint': replace 'CPU' with 'CPU or core' 2019-09-10 14:03:31 +02:00
Lzu Tao
f60b5f1bc7 Remove unneeded feature attr from atomic integers doctests 2019-06-04 13:24:39 +00:00
Mazdak Farrokhzad
dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Taiki Endo
360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
Christian
ab3b657373 Updated the documentation of core::hints::spin_loop and core::sync::spin_loop_hint 2019-04-03 10:54:07 +02:00
Mark Rousskov
2870015b7b Bootstrap compiler update for 1.35 release 2019-03-02 09:05:34 -07:00
Mahmut Bulut
99d67ca3b8
Destabilize fixed-width const defined atomic integers
* With this PR 1.34.0 onwards const declarations of atomic integers will be
  unstable.
2019-02-21 13:57:51 +01:00
Oliver Scherer
4056b575e2 Add suggestions to deprecation lints 2019-01-30 17:49:04 +01:00
Mark Rousskov
7a58c6d1de Replace deprecated ATOMIC_INIT consts 2019-01-26 15:27:38 -07:00
Alex Crichton
14b36fb15a std: Stabilize fixed-width integer atomics
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-25 11:48:10 -08:00
Clar Fon
24ca530526 Move spin_loop_hint to core::hint module 2019-01-15 16:44:28 -05:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Pietro Albini
b08a52c8d4
Rollup merge of #56881 - Amanieu:ordering_eq, r=alexcrichton
Implement Eq, PartialEq and Hash for atomic::Ordering

r? @alexcrichton
2018-12-19 11:47:11 +01:00
Amanieu d'Antras
cd70d7df7b Implement Eq, PartialEq and Hash for atomic::Ordering 2018-12-16 16:37:18 +00:00
Mazdak Farrokhzad
443881a37b
Rollup merge of #53506 - phungleson:fix-from-docs-atomic, r=KodrAus
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-16 14:08:13 +01:00
Alex Crichton
cf47a19305 Bump to 1.33.0
* 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-12 08:09:26 -08:00
Son
94c1c7328a Documentation for impl From for AtomicBool and other Atomic types 2018-12-12 09:41:12 +11:00
Michal 'vorner' Vaner
cc63bd47ef
atomic::Ordering: Get rid of misleading parts of intro
Remove the parts of atomic::Ordering's intro that wrongly claimed that
SeqCst prevents all reorderings around it.

Closes #55196
2018-11-18 11:12:01 +01:00
Simonas Kazlauskas
99f7dc451f Do not Atomic{I,U}128 in stage0 2018-11-05 18:54:17 +02:00
Simonas Kazlauskas
5e50acf443 Make the Atomic types repr(C) to ensure newtype 2018-10-27 13:47:12 +03:00
Oliver Middleton
01674fbe06 Correct alignment of atomic types and (re)add Atomic{I,U}128
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
2018-10-27 13:47:11 +03:00
Alex Crichton
b4877edd67 std: Start implementing wasm32 atomics
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-24 15:55:35 -07:00
Jorge Aparicio
828289610b remove (more) CAS API from Atomic* types where not natively supported
closes #54276
2018-09-16 23:04:11 +02:00
Alex Crichton
0338d340c4 Remove #[repr(transparent)] from atomics
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-09-05 15:41:44 -07:00
varkor
bbf0b159b7 Make core::sync::atomic::Ordering #[non_exhaustive] 2018-08-15 17:11:42 +01:00
Ralf Jung
6a018a03df document mode possibilities for all RMW operations 2018-08-07 11:57:43 +02:00
Ralf Jung
1733bd3cbd list possible orderings for load and store 2018-08-07 11:33:20 +02:00
Ralf Jung
110bcc9798 forgot to add comment for some atomic types 2018-08-07 11:26:05 +02:00
Ralf Jung
e9a86a2e1a fix link label; use more https 2018-08-07 11:23:30 +02:00
Ralf Jung
621d06481d atomic ordering docs 2018-08-06 12:05:59 +02:00
Mark Rousskov
683a3db01f Switch to bootstrapping from 1.29 beta 2018-08-01 11:59:08 -06:00
willmo
e769deca99
Add #[repr(transparent)] to Atomic* types
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-07 20:09:34 -07:00
Jorge Aparicio
0ed32313a2 #[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")] 2018-07-05 16:52:46 -05:00
Jorge Aparicio
bbf688a84d enable Atomic*.{load,store} for ARMv6-M / MSP430
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-07-05 16:44:29 -05:00
bors
230b97af1c Auto merge of #48553 - seanmonstar:atomic-debug, r=alexcrichton
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-19 23:08:16 +00:00
bors
532764cb79 Auto merge of #49963 - llogiq:stabilize-13226, r=kennytm
stabilize fetch_nand

This closes #13226 and makes `Atomic*.fetch_nand` stable.
2018-04-16 07:44:25 +00:00
Andre Bogus
c68c90a232 stabilize fetch_nand 2018-04-14 15:51:31 +02:00
Andre Bogus
2f603413ab improve Atomic*::fetch_update docs 2018-04-12 22:48:48 +02:00
kennytm
920249abdd
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm
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-04-05 16:51:16 +08:00
Andre Bogus
0f5e419163 Add a generic CAS loop to std::sync::Atomic*
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-30 12:27:14 +02:00
Tim Neumann
9e4d5cf0ce
Rollup merge of #49170 - steveklabnik:gh49127, r=nagisa
Clarify AcqRel's docs

This implied things that are not true.

Fixes #49127
2018-03-26 15:14:57 +02:00
Steve Klabnik
23013c791c
update wording as per feedback 2018-03-25 14:19:27 +02:00
Guillaume Gomez
2b64799365 Make Atomic doc examples specific to each type 2018-03-19 21:43:45 +01:00
steveklabnik
deae8de673 Clarify AcqRel's docs
This implied things that are not true.

Fixes #49127
2018-03-19 14:34:51 +01:00