about summary refs log tree commit diff
path: root/src/libstd/thread.rs
AgeCommit message (Collapse)AuthorLines
2015-03-23Implement RFC 909: move thread_local into threadAaron Turon-960/+0
This commit implements [RFC 909](https://github.com/rust-lang/rfcs/pull/909): The `std::thread_local` module is now deprecated, and its contents are available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and `ScopedKey`. The macros remain exactly as they were, which means little if any code should break. Nevertheless, this is technically a: [breaking-change] Closes #23547
2015-03-21Auto merge of #23470 - alexcrichton:less-prelude, r=aturonbors-2/+3
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-20std: Remove old_io/old_path from the preludeAlex Crichton-2/+3
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-4/+4
2015-03-17Auto merge of #23330 - alexcrichton:thread-sleep, r=aturonbors-0/+19
This function is the current replacement for `std::old_io::timer` which will soon be deprecated. This function is unstable and has its own feature gate as it does not yet have an RFC nor has it existed for very long.
2015-03-17std: Implement `thread::sleep`Alex Crichton-0/+19
This function is the current replacement for `std::old_io::timer` which will soon be deprecated. This function is unstable and has its own feature gate as it does not yet have an RFC nor has it existed for very long.
2015-03-16thread: 'dur' -> 'duration'Tshepang Lekhonkhobe-6/+6
Also: - italize the binding name - complete a sentence
2015-03-13Fallout of std::old_io deprecationAlex Crichton-14/+0
2015-03-12std: Stabilize the `io` moduleAlex Crichton-22/+11
The new `std::io` module has had some time to bake now, and this commit stabilizes its functionality. There are still portions of the module which remain unstable, and below contains a summart of the actions taken. This commit also deprecates the entire contents of the `old_io` module in a blanket fashion. All APIs should now have a reasonable replacement in the new I/O modules. Stable APIs: * `std::io` (the name) * `std::io::prelude` (the name) * `Read` * `Read::read` * `Read::{read_to_end, read_to_string}` after being modified to return a `usize` for the number of bytes read. * `Write` * `Write::write` * `Write::{write_all, write_fmt}` * `BufRead` * `BufRead::{fill_buf, consume}` * `BufRead::{read_line, read_until}` after being modified to return a `usize` for the number of bytes read. * `BufReader` * `BufReader::{new, with_capacity}` * `BufReader::{get_ref, get_mut, into_inner}` * `{Read,BufRead} for BufReader` * `BufWriter` * `BufWriter::{new, with_capacity}` * `BufWriter::{get_ref, get_mut, into_inner}` * `Write for BufWriter` * `IntoInnerError` * `IntoInnerError::{error, into_inner}` * `{Error,Display} for IntoInnerError` * `LineWriter` * `LineWriter::{new, with_capacity}` - `with_capacity` was added * `LineWriter::{get_ref, get_mut, into_inner}` - `get_mut` was added) * `Write for LineWriter` * `BufStream` * `BufStream::{new, with_capacities}` * `BufStream::{get_ref, get_mut, into_inner}` * `{BufRead,Read,Write} for BufStream` * `stdin` * `Stdin` * `Stdin::lock` * `Stdin::read_line` - added method * `StdinLock` * `Read for Stdin` * `{Read,BufRead} for StdinLock` * `stdout` * `Stdout` * `Stdout::lock` * `StdoutLock` * `Write for Stdout` * `Write for StdoutLock` * `stderr` * `Stderr` * `Stderr::lock` * `StderrLock` * `Write for Stderr` * `Write for StderrLock` * `io::Result` * `io::Error` * `io::Error::last_os_error` * `{Display, Error} for Error` Unstable APIs: (reasons can be found in the commit itself) * `Write::flush` * `Seek` * `ErrorKind` * `Error::new` * `Error::from_os_error` * `Error::kind` Deprecated APIs * `Error::description` - available via the `Error` trait * `Error::detail` - available via the `Display` implementation * `thread::Builder::{stdout, stderr}` Changes in functionality: * `old_io::stdio::set_stderr` is now a noop as the infrastructure for printing backtraces has migrated to `std::io`. * The `ReadExt`, `WriteExt`, and `BufReadExt` extension traits were all removed by folding functionality into the corresponding trait. [breaking-change]
2015-03-12std: Remove #[allow] directives in sys modulesAlex Crichton-10/+6
These were suppressing lots of interesting warnings! Turns out there was also quite a bit of dead code.
2015-03-11Explain why immediately dropping a JoinGuard is not what you want to doJake Goulding-1/+1
2015-03-09remove uses of as_slice where deref coercions can be usedRicho Healey-1/+1
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-1/+1
2015-03-03Add `: Box<_>` or `::Box<_>` type annotations to various places.Felix S. Klock II-1/+1
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-03-03Revert incorrect `usize` -> `u32` replacements from #22510Tobias Bucher-6/+6
Conflicts: src/libstd/thread.rs
2015-03-03Rollup merge of #22876 - Florob:const, r=nikomatsakisManish Goregaokar-1/+1
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-03Rollup merge of #22689 - tshepang:thread-doc-improvements, r=steveklabnikManish Goregaokar-22/+16
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-1/+1
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-01Replace int/uint by isize/usizeGuillaumeGomez-10/+10
2015-02-24Rollup merge of #22604 - aochagavia:docs, r=alexcrichtonManish Goregaokar-5/+8
2015-02-23doc: I learnt from review that this is now implementedTshepang Lekhonkhobe-4/+0
2015-02-22doc: nits and fixes for thread APITshepang Lekhonkhobe-18/+16
2015-02-22Rollup merge of #22567 - Gankro:unstable, r=alexcrichtonManish Goregaokar-2/+2
* Adds features and allows * Removes unused muts, unused imports, dead code * Migrates some deprecated code to new io/env * Changes std::num::uint/int to be re-exports of std::num::usize/isize libcollections, liballoc, and libcoretest no longer warn during testing. libstd warns much less, though there's some dangly bits that weren't obvious fixes. In particular, how to only supress deprecated warnings in specific submodules of std.
2015-02-22Rollup merge of #22545 - Ryman:fucntion, r=dotdashManish Goregaokar-14/+14
2015-02-21Fix thread documentationAdolfo Ochagavía-5/+8
2015-02-20try to reduce bajillion warningsAlexis-2/+2
2015-02-19typo: fucntion -> functionKevin Butler-14/+14
2015-02-18Minor unused imports etc.Niko Matsakis-1/+1
2015-02-18Fallout: extend thread with phantomdata for `'a` lifetimeNiko Matsakis-3/+3
2015-02-17Test fixes and rebase conflictsAlex Crichton-13/+12
2015-02-17rollup merge of #22319: huonw/send-is-not-staticAlex Crichton-8/+8
Conflicts: src/libstd/sync/task_pool.rs src/libstd/thread.rs src/libtest/lib.rs src/test/bench/shootout-reverse-complement.rs src/test/bench/shootout-spectralnorm.rs
2015-02-17Test fixes and rebase conflictsAlex Crichton-18/+18
2015-02-18Update tests for the Send - 'static change.Huon Wilson-2/+2
2015-02-17Fallout from stabilizationAaron Turon-41/+61
2015-02-17Revise std::thread semanticsAaron Turon-107/+263
This commit makes several changes to `std::thread` in preparation for final stabilization: * It removes the ability to handle panics from `scoped` children; see #20807 for discussion * It adds a `JoinHandle` structure, now returned from `spawn`, which makes it possible to join on children that do not share data from their parent's stack. The child is automatically detached when the handle is dropped, and the handle cannot be copied due to Posix semantics. * It moves all static methods from `std::thread::Thread` to free functions in `std::thread`. This was done in part because, due to the above changes, there are effectively no direct `Thread` constructors, and the static methods have tended to feel a bit awkward. * Adds an `io::Result` around the `Builder` methods `scoped` and `spawn`, making it possible to handle OS errors when creating threads. The convenience free functions entail an unwrap. * Stabilizes the entire module. Despite the fact that the API is changing somewhat here, this is part of a long period of baking and the changes are addressing all known issues prior to alpha2. If absolutely necessary, further breaking changes can be made prior to beta. Closes #20807 [breaking-change]
2015-02-18Add missing marker to std::thread::JoinGuard.Huon Wilson-1/+3
The lifetime was previously, incorrectly unconstrained.
2015-02-18Update the libraries to reflect Send loosing the 'static bound.Huon Wilson-7/+7
In most places this preserves the current API by adding an explicit `'static` bound. Notably absent are some impls like `unsafe impl<T: Send> Send for Foo<T>` and the `std::thread` module. It is likely that it will be possible to remove these after auditing the code to ensure restricted lifetimes are safe. More progress on #22251.
2015-02-10Move native thread name setting from thread_info to Thread, fixes #21911Vojtech Kral-0/+1
2015-02-08Move native thread name setting from thread_info to Thread, fixes #21911Vojtech Kral-0/+4
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-3/+2
2015-02-04remove all kind annotations from closuresJorge Aparicio-3/+3
2015-01-30Implement Thread::park_timeoutCarl Lerche-1/+56
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-2/+2
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Fallout of io => old_ioAlex Crichton-2/+2
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-7/+7
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2015-01-23grandfathered -> rust1Brian Anderson-14/+14
2015-01-23Set unstable feature names appropriatelyBrian Anderson-11/+11
* `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-22Rollup merge of #21325 - nagisa:thread-panicking, r=steveklabnikSteve Klabnik-1/+1
Previous wording wasn’t clear about its actual behaviour. It could be interpreted as answering either: * Can current thread panic? * Is current thread unwinding because of panic? r? @steveklabnik
2015-01-21Remove 'since' from unstable attributesBrian Anderson-11/+11
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-25/+33