about summary refs log tree commit diff
path: root/src/libcore/atomic.rs
AgeCommit message (Collapse)AuthorLines
2015-08-17core: Move `atomic` into a new `sync` moduleAlex Crichton-1113/+0
This mirrors the same hierarchy in the standard library.
2015-07-30Auto merge of #27052 - wthrowe:atomic_send, r=Gankrobors-1/+2
I think this was just missed when `Send` and `Sync` were redone, since it seems odd to not be able to use things like `Arc<AtomicPtr>`. If it was intentional feel free to just close this. I used another test as a template for writing mine, so I hope I got all the headers and stuff right.
2015-07-29Fix a documentation bug for memory orderingsJeehoon Kang-1/+1
As described in the module documentation, the memory orderings in Rust are the same with that of LLVM. However, the documentation for the memory orderings enum says the memory orderings are the same of that of C++. Note that they differ in that C++'s support the consume reads, while LLVM's does not. Hence this commit fixes the bug in the documentation for the enum.
2015-07-20impl Debug for Atomic typesarthurprs-0/+21
2015-07-15Make AtomicPtr SendWilliam Throwe-1/+2
This appears to have just been an oversight, and it is annoying to not be able to use an Arc<AtomicPtr>.
2015-07-04Update atomic.rsWei-Ming Yang-9/+0
Remove the tagged attribute `stable` from all private functions
2015-06-29Refine Atomic*::compare_and_swap documentationSimonas Kazlauskas-23/+23
Namely: * Change parameter `old` to read `current` so it is clearer what the argument refers to (originally suggested `expected`, but shot down by Steve); * Add some formatting and fix some mistakes like referring to the method as `swap` rather than `compare_and_swap`.
2015-06-10Improve examples for atomic types.Johannes Oertel-54/+71
Swap arguments of `assert_eq!` calls, insert additional assertions here and there. Closes #26169.
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-27/+20
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-5/+5
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-04-25Provide a Default implementation for AtomicPtrJake Goulding-0/+6
Closes #24613
2015-04-10Add Default trait for AtomicBool, AtomicIsize and AtomicUsizeGuillaume Gomez-0/+20
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-1/+1
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01fallout from feature-gating unary negation on unsigned integers.Felix S. Klock II-1/+1
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-1/+1
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-141/+0
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-27rollup merge of #23793: steveklabnik/gh21668Alex Crichton-4/+8
Fixes #21668
2015-03-27Update return value docs in atomics docsSteve Klabnik-4/+8
Fixes #21668
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-22/+22
Now that support has been removed, all lingering use cases are renamed.
2015-03-02Enable recursion for visit_ty in lint visitorIvan Petkov-0/+2
* The lint visitor's visit_ty method did not recurse, and had a reference to the now closed #10894 * The newly enabled recursion has only affected the `deprectated` lint which now detects uses of deprecated items in trait impls and function return types * Renamed some references to `CowString` and `CowVec` to `Cow<str>` and `Cow<[T]>`, respectively, which appear outside of the crate which defines them * Replaced a few instances of `InvariantType<T>` with `PhantomData<Cell<T>>` * Disabled the `deprecated` lint in several places that reference/implement traits on deprecated items which will get cleaned up in the future * Disabled the `exceeding_bitshifts` lint for compile-fail/huge-array-simple test so it doesn't shadow the expected error on 32bit systems * Unfortunately, this means that if a library declares `#![deny(deprecated)]` and marks anything as deprecated, it will have to disable the lint for any uses of said item, e.g. any impl the now deprecated item For any library that denies deprecated items but has deprecated items of its own, this is a [breaking-change]
2015-02-21Remove mention of non-existing AtomicOption in docsWesley Wiser-1/+1
AtomicOption was removed in 7d8d06f86b48520814596bd5363d2b82bc619774 but the docs weren't updated. Fixes #22586
2015-02-18Fallout: AtomicPtr needs phantom data to indicate that it contains an unsafe ↵Niko Matsakis-1/+4
pointer.
2015-02-17Fallout from stabilizationAaron Turon-2/+2
2015-02-13Refer to LLVM rather than GCC wiki for atomic orderingsSteve Klabnik-2/+2
Fixes #22064.
2015-01-30std: Stabilize Atomic{Isize,Usize} methodsAlex Crichton-0/+20
These methods were intended to be stable as of #16258 but the tags have since been lost in various refactorings. This commit re-adds the `#[stable]` attributes to each of these functions.
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-10/+10
Conflicts: src/libcore/cmp.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/result.rs src/libcore/str/mod.rs src/librustc/lint/builtin.rs src/librustc/lint/context.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/poison.rs
2015-01-25Moving away from deprecated i/u suffixes in libcoreAlfie John-10/+10
2015-01-23grandfathered -> rust1Brian Anderson-40/+40
2015-01-23Deprecated attributes don't take 'feature' names and are paired with ↵Brian Anderson-4/+8
stable/unstable Conflicts: src/libcore/atomic.rs src/libcore/finally.rs src/test/auxiliary/inherited_stability.rs src/test/auxiliary/lint_stability.rs
2015-01-23Set unstable feature names appropriatelyBrian Anderson-4/+4
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-44/+48
2015-01-17Remove unnecessary explicit conversions to *const Twe-6/+6
2015-01-11Rename AtomicInt and AtomicUintSteven Fackler-127/+258
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-06rollup merge of #20615: aturon/stab-2-threadAlex Crichton-1/+1
This commit takes a first pass at stabilizing `std::thread`: * It removes the `detach` method in favor of two constructors -- `spawn` for detached threads, `scoped` for "scoped" (i.e., must-join) threads. This addresses some of the surprise/frustrating debug sessions with the previous API, in which `spawn` produced a guard that on destruction joined the thread (unless `detach` was called). The reason to have the division in part is that `Send` will soon not imply `'static`, which means that `scoped` thread creation can take a closure over *shared stack data* of the parent thread. On the other hand, this means that the parent must not pop the relevant stack frames while the child thread is running. The `JoinGuard` is used to prevent this from happening by joining on drop (if you have not already explicitly `join`ed.) The APIs around `scoped` are future-proofed for the `Send` changes by taking an additional lifetime parameter. With the current definition of `Send`, this is forced to be `'static`, but when `Send` changes these APIs will gain their full flexibility immediately. Threads that are `spawn`ed, on the other hand, are detached from the start and do not yield an RAII guard. The hope is that, by making `scoped` an explicit opt-in with a very suggestive name, it will be drastically less likely to be caught by a surprising deadlock due to an implicit join at the end of a scope. * The module itself is marked stable. * Existing methods other than `spawn` and `scoped` are marked stable. The migration path is: ```rust Thread::spawn(f).detached() ``` becomes ```rust Thread::spawn(f) ``` while ```rust let res = Thread::spawn(f); res.join() ``` becomes ```rust let res = Thread::scoped(f); res.join() ``` [breaking-change]
2015-01-07markers -> markerNick Cameron-1/+1
2015-01-06Fallout from stabilizationAaron Turon-1/+1
2015-01-07Change `std::kinds` to `std::markers`; flatten `std::kinds::marker`Nick Cameron-1/+1
[breaking-change]
2015-01-05Revert "Remove i suffix in docs"Alex Crichton-9/+9
This reverts commit f031671c6ea79391eeb3e1ad8f06fe0e436103fb. Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05rollup merge of #20565: alexcrichton/missing-stabilityAlex Crichton-35/+7
Conflicts: src/libstd/sync/mpsc/mod.rs
2015-01-05Remove i suffix in docsSteve Klabnik-9/+9
2015-01-05std: Move Atomic{Int,Uint} back to unstableAlex Crichton-24/+6
The int/uint story is under heavy development, and these types are likely to be renamed.
2015-01-04std: Fix missing stability in syncAlex Crichton-13/+3
* The `sync` module is stable * The `sync::mpsc` module is stable * The `Sender::send` method is stable. * The `Once::doit` method is now removed. * Deprecated atomic initializers are removed. * Renamed atomic initializers are now stable.
2015-01-03Remove deprecated functionalityAlex Crichton-60/+118
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-1/+1
2015-01-01std: Second pass stabilization of syncAlex Crichton-3/+13
This pass performs a second pass of stabilization through the `std::sync` module, avoiding modules/types that are being handled in other PRs (e.g. mutexes, rwlocks, condvars, and channels). The following items are now stable * `sync::atomic` * `sync::atomic::ATOMIC_BOOL_INIT` (was `INIT_ATOMIC_BOOL`) * `sync::atomic::ATOMIC_INT_INIT` (was `INIT_ATOMIC_INT`) * `sync::atomic::ATOMIC_UINT_INIT` (was `INIT_ATOMIC_UINT`) * `sync::Once` * `sync::ONCE_INIT` * `sync::Once::call_once` (was `doit`) * C == `pthread_once(..)` * Boost == `call_once(..)` * Windows == `InitOnceExecuteOnce` * `sync::Barrier` * `sync::Barrier::new` * `sync::Barrier::wait` (now returns a `bool`) * `sync::Semaphore::new` * `sync::Semaphore::acquire` * `sync::Semaphore::release` The following items remain unstable * `sync::SemaphoreGuard` * `sync::Semaphore::access` - it's unclear how this relates to the poisoning story of mutexes. * `sync::TaskPool` - the semantics of a failing task and whether a thread is re-attached to a thread pool are somewhat unclear, and the utility of this type in `sync` is question with respect to the jobs of other primitives. This type will likely become stable or move out of the standard library over time. * `sync::Future` - futures as-is have yet to be deeply re-evaluated with the recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time comes. [breaking-change]
2014-12-30Remove core::atomic::Ordering::* public reexportCorey Farwell-1/+1
Part of #19253 [breaking-change]
2014-12-26Move RacyCell to `std::comm`Flavio Percoco-12/+22
RacyCell is not exactly what we'd like as a final implementation for this. Therefore, we're moving it under `std::comm` and also making it private.
2014-12-26Require types to opt-in SyncFlavio Percoco-12/+12
2014-12-19libcore: use `#[deriving(Copy)]`Jorge Aparicio-3/+1
2014-12-15Remove internal uses of `marker::NoCopy`Jorge Aparicio-12/+7