about summary refs log tree commit diff
path: root/src/libstd/sync
AgeCommit message (Collapse)AuthorLines
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-3/+2
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-08-03syntax: Implement #![no_core]Alex Crichton-8/+18
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-29std: Remove the curious inner moduleAlex Crichton-2/+2
This isn't actually necessary any more with the advent of `$crate` and changes in the compiler to expand macros to `::core::$foo` in the context of a `#![no_std]` crate. The libcore inner module was also trimmed down a bit to the bare bones.
2015-07-27Show appropriate feature flags in docsSteve Klabnik-7/+14
2015-07-01Expand docs for recvSteve Klabnik-0/+42
Add an example, plus some text that covers the buffering nature of channels. Fixes #26497
2015-06-17More test fixes and fallout of stability changesAlex Crichton-10/+8
2015-06-17std: Deprecate the `future` featureAlex Crichton-0/+4
This commit deprecates the `sync::Future` type to be developed outside in crates.io instead.
2015-06-17std: Stabilize the `once_new` featureAlex Crichton-1/+1
This function follows the well-established "constructor" pattern and the initialization constant will likely be deprecated in favor of it once `const_fn` is stabilized.
2015-06-17std: Stabilize the sync_poison featureAlex Crichton-2/+2
These accessor/constructor methods for a `PoisonError` are quite standard for a wrapper type and enable manipulation of the underlying type.
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-2/+4
2015-06-17std: Split the `std_misc` featureAlex Crichton-39/+18
2015-06-03Add priority policy to RWLock API Documentationwebmobster-0/+4
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-50/+77
2015-05-25Remove unsafe block around boxed::into_raw() as it is now safeMichael Layzell-6/+4
2015-05-14Auto merge of #24920 - alexcrichton:duration, r=aturonbors-19/+63
This commit is an implementation of [RFC 1040][rfc] which is a redesign of the currently-unstable `Duration` type. The API of the type has been scaled back to be more conservative and it also no longer supports negative durations. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1040-duration-reform.md The inner `duration` module of the `time` module has now been hidden (as `Duration` is reexported) and the feature name for this type has changed from `std_misc` to `duration`. All APIs accepting durations have also been audited to take a more flavorful feature name instead of `std_misc`. Closes #24874
2015-05-13std: Redesign Duration, implementing RFC 1040Alex Crichton-19/+63
This commit is an implementation of [RFC 1040][rfc] which is a redesign of the currently-unstable `Duration` type. The API of the type has been scaled back to be more conservative and it also no longer supports negative durations. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1040-duration-reform.md The inner `duration` module of the `time` module has now been hidden (as `Duration` is reexported) and the feature name for this type has changed from `std_misc` to `duration`. All APIs accepting durations have also been audited to take a more flavorful feature name instead of `std_misc`. Closes #24874
2015-05-13RebasingNick Cameron-22/+24
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-47/+47
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-05-06Auto merge of #24392 - seanmonstar:lint-transmute-mut, r=alexcrichtonbors-11/+19
The [UnsafeCell documentation says it is undefined behavior](http://doc.rust-lang.org/nightly/std/cell/struct.UnsafeCell.html), so people shouldn't do it. This happened to catch one case in libstd that was doing this, and I switched that to use an UnsafeCell internally. Closes #13146
2015-05-06Update documentation for RwLock::try_{read,write}.John Gallagher-10/+17
2015-05-06Make RwLock::try_write try to obtain a write lockJohn Gallagher-2/+19
2015-05-05std: update select internals to not use mutable transmutingSean McArthur-11/+19
2015-05-02Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTsP1start-34/+63
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
2015-04-30Add downcasting to std::error::ErrorAaron Turon-3/+3
This commit brings the `Error` trait in line with the [Error interoperation RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting, which has long been intended. This change means that for any `Error` trait objects that are `'static`, you can downcast to concrete error types. To make this work, it is necessary for `Error` to inherit from `Reflect` (which is currently used to mark concrete types as "permitted for reflection, aka downcasting"). This is a breaking change: it means that impls like ```rust impl<T> Error for MyErrorType<T> { ... } ``` must change to something like ```rust impl<T: Reflect> Error for MyErrorType<T> { ... } ``` except that `Reflect` is currently unstable (and should remain so for the time being). For now, code can instead bound by `Any`: ```rust impl<T: Any> Error for MyErrorType<T> { ... } ``` which *is* stable and has `Reflect` as a super trait. The downside is that this imposes a `'static` constraint, but that only constrains *when* `Error` is implemented -- it does not actually constrain the types that can implement `Error`. [breaking-change]
2015-04-29rollup merge of #24908: inrustwetrust/once_memory_orderingAlex Crichton-1/+5
`call_once` guarantees that there is a happens-before relationship between its closure and code following it via the sequentially consistent atomic store/loads of `self.cnt`.
2015-04-28Register new snapshotsTamir Duberstein-17/+0
2015-04-28Clarify Once::call_once memory ordering guarantees in docsinrustwetrust-1/+5
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-6/+6
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-23Auto merge of #24633 - rapha:master, r=alexcrichtonbors-0/+57
2015-04-24Implement IntoIterator for ReceiverRaphael Speyer-0/+57
2015-04-23Indicate trait names in doc-comment are code-likeCorey Farwell-1/+1
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-8/+0
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-27/+27
2015-04-09Indicate keyword in doc comment is code-likeCorey Farwell-2/+2
2015-04-08Auto merge of #24029 - nagisa:print-locking, r=alexcrichtonbors-202/+14
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. I’m not sure whether we want to do this change, though, because it has the same deadlock hazard which we tried to avoid by not locking inside write_fmt itself (see [this comment](https://github.com/rust-lang/rust/blob/80def6c2447d23a624e611417f24cf0ab2a5a676/src/libstd/io/stdio.rs#L267)). Spotted on [reddit]. cc @alexcrichton [reddit]: http://www.reddit.com/r/rust/comments/31comh/println_with_multiple_threads/
2015-04-08Implement reentrant mutexes and make stdio use themSimonas Kazlauskas-202/+14
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides write_fmt to lock the stdio handle for the whole duration of the call.
2015-04-07Remove another invalid exampleŁukasz Niemier-26/+0
2015-04-07Remove incorrect example from docsŁukasz Niemier-26/+0
2015-04-01Test fixes and rebase conflicts, round 2Alex Crichton-22/+22
2015-04-01rollup merge of #23176: huonw/rm-boundsAlex Crichton-34/+36
2015-04-01rollup merge of #23949: aturon/stab-timeoutAlex Crichton-19/+31
This commit renames and stabilizes: * `Condvar::wait_timeout_ms` (renamed from `wait_timeout`) * `thread::park_timeout_ms` (renamed from `park_timeout`) * `thread::sleep_ms` (renamed from `sleep`) In each case, the timeout is taken as a `u32` number of milliseconds, rather than a `Duration`. These functions are likely to be deprecated once a stable form of `Duration` is available, but there is little cost to having these named variants around, and it's crucial functionality for 1.0. [breaking-change] r? @alexcrichton cc @sfackler @carllerche
2015-04-01Stabilize basic timeout functionalityAaron Turon-19/+31
This commit renames and stabilizes: * `Condvar::wait_timeout_ms` (renamed from `wait_timeout`) * `thread::park_timeout_ms` (renamed from `park_timeout`) * `thread::sleep_ms` (renamed from `sleep`) In each case, the timeout is taken as a `u32` number of milliseconds, rather than a `Duration`. These functions are likely to be deprecated once a stable form of `Duration` is available, but there is little cost to having these named variants around, and it's crucial functionality for 1.0. [breaking-change]
2015-04-01Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an aliasNiko Matsakis-2/+3
for `Box<FnBox()>`. I found the alias was still handy because it is shorter than the fully written type. This is a [breaking-change]: convert code using `Invoke` to use `FnBox`, which is usually pretty straight-forward. Code using thunk mostly works if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to `foo(arg)`.
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-226/+0
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31rollup merge of #23879: seanmonstar/del-from-errorAlex Crichton-3/+3
Conflicts: src/libcore/error.rs
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-226/+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-31Indicate select! is code-likeCorey Farwell-1/+1
2015-03-30convert: remove FromError, use From<E> insteadSean McArthur-3/+3
This removes the FromError trait, since it can now be expressed using the new convert::Into trait. All implementations of FromError<E> where changed to From<E>, and `try!` was changed to use From::from instead. Because this removes FromError, it is a breaking change, but fixing it simply requires changing the words `FromError` to `From`, and `from_error` to `from`. [breaking-change]
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-1/+1
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1