about summary refs log tree commit diff
path: root/src/libstd/sync/atomics.rs
AgeCommit message (Collapse)AuthorLines
2014-06-11sync: Move underneath libstdAlex Crichton-234/+0
This commit is the final step in the libstd facade, #13851. The purpose of this commit is to move libsync underneath the standard library, behind the facade. This will allow core primitives like channels, queues, and atomics to all live in the same location. There were a few notable changes and a few breaking changes as part of this movement: * The `Vec` and `String` types are reexported at the top level of libcollections * The `unreachable!()` macro was copied to libcore * The `std::rt::thread` module was moved to librustrt, but it is still reexported at the same location. * The `std::comm` module was moved to libsync * The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`. It is now a private module with types/functions being reexported under `sync::comm`. This is a breaking change for any existing users of duplex streams. * All concurrent queues/deques were moved directly under libsync. They are also all marked with #![experimental] for now if they are public. * The `task_pool` and `future` modules no longer live in libsync, but rather live under `std::sync`. They will forever live at this location, but they may move to libsync if the `std::task` module moves as well. [breaking-change]
2014-05-13core: Inherit the atomics moduleAlex Crichton-795/+21
2014-05-11core: Remove the cast moduleAlex Crichton-10/+10
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-5/+6
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-13/+13
2014-04-11Add more type signatures to the docs; tweak a few of them.Huon Wilson-1/+1
Someone reading the docs won't know what the types of various things are, so this adds them in a few meaningful places to help with comprehension. cc #13423.
2014-04-03Add fetch_and, fetch_or, fetch_xor to AtomicInt, AtomicUintJonathan S-1/+133
2014-03-31std: Switch field privacy as necessaryAlex Crichton-9/+9
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-28Rename Pod into CopyFlavio Percoco-11/+11
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-24std: Unignore atomic testsBrian Anderson-4/+2
2014-03-20std: Update atomic documentation to remove 'mut'Alex Crichton-23/+23
It's all no longer necessary
2014-03-20std: Remove AtomicU64Brian Anderson-52/+0
Support for this is less universal than for word-size things; it has no users; i'd rather play it safe.
2014-03-20std: Make the generic atomics in `sync::atomics` privateBrian Anderson-10/+10
I'm not comfortable exposing public functions that purport to do atomic operations on arbitrary T.
2014-03-20std: Make the generic atomics take unsafe pointersBrian Anderson-45/+45
These mutate values behind references that are Freeze, which is not allowed.
2014-03-20std: Make atomics immutable. #11583Brian Anderson-42/+42
In Rust, the strongest guarantee that `&mut` provides is that the memory pointed to is *not aliased*, whereas `&`'s guarantees are much weaker: that the value can be aliased, and may be mutated under proper precautions (interior mutability). Our atomics though use `&mut` for mutation even while creating multiple aliases, so this changes them to use 'interior mutability', mutating through immutable references.
2014-03-20Make atomics interior Unsafe<T>Flavio Percoco-50/+60
2014-03-17std: Improve docs for atomics. Fix two bugsBrian Anderson-68/+393
This adds lots of docs to the atomics module. Two of the examples are using the future atomics API and are ignored temporarily. I discovered a bug in the way AtomicBool's fetch_nand method is implemented and fixed it by using the correct value for `true`. I also fixed the implementation of AcqRel fences (it was only doing a release barrier), and made a "relaxed" fence a failure.
2014-03-16Remove AtomicFlagCadence Marseille-41/+6
fixes #12943
2014-03-14fix MIPS targetJyun-Yan You-0/+4
I ignored AtomicU64 methods on MIPS target because libgcc doesn't implement MIPS32 64-bit atomic operations. Otherwise it would cause link failure.
2014-02-23std: Move intrinsics to std::intrinsics.Brian Anderson-1/+1
Issue #1457
2014-02-04Register new snapshotsAlex Crichton-190/+0
2014-02-04Replace NonCopyable usage with NoPodFlavio Percoco-20/+20
cc #10834
2014-02-03Various bug fixes and rebase conflictsAlex Crichton-1/+1
2014-02-03Add an AtomicU64 type to std::sync::atomicsAlex Crichton-32/+245
This also generalizes all atomic intrinsics over T so we'll be able to add u8 atomics if we really feel the need to (do we really want to?)
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-2/+1
2013-12-24std: Introduce std::syncAlex Crichton-0/+603
For now, this moves the following modules to std::sync * UnsafeArc (also removed unwrap method) * mpsc_queue * spsc_queue * atomics * mpmc_bounded_queue * deque We may want to remove some of the queues, but for now this moves things out of std::rt into std::sync