summary refs log tree commit diff
path: root/src/libstd/thread
AgeCommit message (Collapse)AuthorLines
2016-08-03Add link to replacement functionStefan Schindler-1/+6
2016-08-03Add an example to `std::thread::park_timeout`Stefan Schindler-0/+19
2016-06-28Rollup merge of #34406 - frewsxcv:sleep-ex, r=alexcrichtonGuillaume Gomez-0/+13
Add example for `std::thread::sleep`. None
2016-06-27Add example for `std::thread::sleep`.Corey Farwell-0/+13
2016-06-25Auto merge of #34465 - frewsxcv:builder-name-example, r=GuillaumeGomezbors-0/+15
Add doc example for `std::thread::Builder::name`. None
2016-06-25Auto merge of #34410 - frewsxcv:code-like, r=apasel422bors-4/+4
Parameters in doc comment should be formatted code-like. None
2016-06-25Rollup merge of #34438 - frewsxcv:joinhandle, r=GuillaumeGomezManish Goregaokar-0/+30
Indicate how the `JoinHandle` struct is created. None
2016-06-25Add doc example for `std::thread::Builder::name`.Corey Farwell-0/+15
2016-06-24Add examples in docs for `JoinHandle`.Corey Farwell-0/+24
2016-06-24Use `Option::expect` instead of `unwrap_or_else` with `panic!`.Corey Farwell-3/+3
2016-06-24Indicate how the `JoinHandle` struct is created.Corey Farwell-0/+6
2016-06-23Auto merge of #34077 - durka:patch-23, r=alexcrichtonbors-4/+38
upgrade thread_local! invocation syntax Allows declaring multiple statics in one macro invocation, and supports attaching attributes to the generated items. In particular, `#![forbid(missing_docs, unused)]` is now tenable on a crate/module containing thread locals. For an example see [here](https://is.gd/aVFZZF). This change is fully backwards compatible as far as I can tell. cc @frankmcsherry
2016-06-22upgrade thread_local! invocation syntaxAlex Burka-4/+38
Allows declaring multiple statics in one macro invocation, and supports attaching attributes to the generated items.
2016-06-22Parameters in doc comment should be formatted code-like.Corey Farwell-4/+4
2016-06-21Rollup merge of #34371 - frewsxcv:thread-name, r=steveklabnikGuillaume Gomez-0/+31
Add examples for `std::thread::Thread::name`. None
2016-06-19Add examples for `std::thread::Thread::name`.Corey Farwell-0/+31
2016-06-18Add example in docs for `std::thread::panicking`.Corey Farwell-0/+29
2016-05-30std: Clean out old unstable + deprecated APIsAlex Crichton-308/+0
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-05-16Added a big-picture explanation for thread::park() & co.Pyry Kontio-1/+3
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-11/+6
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-05-02std::thread docs: spawn() returns not a Thread anymoreGeorg Brandl-15/+14
Also move the "Thread type" section down a bit, since it is not so important anymore. Fixes: #33321
2016-04-25libstd: fix typos in thread::LocalKey docsRyman-2/+2
2016-03-25Fix unsound behaviour with null characters in thread names (issue #32475)David Henningsson-3/+18
Previously, the thread name (&str) was converted to a CString in the new thread, but outside unwind::try, causing a panic to continue into FFI. This patch changes that behaviour, so that the panic instead happens in the parent thread (where panic infrastructure is properly set up), not the new thread. This could potentially be a breaking change for architectures who don't support thread names. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-03-22try! -> ?Jorge Aparicio-1/+1
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-12std: Clean out deprecated APIsAlex Crichton-34/+0
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-0/+10
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-04Stop using unsafe code in TLS macro expansion (fixes #30756)Manish Goregaokar-23/+27
2016-01-29std: Ignore dtors_in_dtors_in_dtors on OSXAlex Crichton-0/+25
This test has been deadlocking and causing problems on the bots basically since its inception. Some memory safety issues were fixed in 987dc84b, but the deadlocks remained afterwards unfortunately. After some investigation, I've concluded that this is just a situation where OSX is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was rewriting the backing TLS memory to its initial state during destruction while we weren't looking, and this would have the effect of canceling the destructors of any other initialized TLS slots. While very difficult to pin down, this is basically what I assume is happening here, so there doesn't seem to really be anythig we can do to ensure the test robustly passes on OSX, so just ignore it for now.
2016-01-11Replace no_elf_tls with target_thread_localAmanieu d'Antras-38/+3
2015-12-29Fix warnings when compiling stdlib with --testFlorian Hahn-5/+5
2015-12-21std: Use cfg(target_thread_local) in thread_local!Alex Crichton-77/+48
This transitions the standard library's `thread_local!` macro to use the freshly-added and gated `#[cfg(target_thread_local)]` attribute. This greatly simplifies the `#[cfg]` logic in play here, but requires that the standard library expose both the OS and ELF TLS implementation modules as unstable implementation details. The implementation details were shuffled around a bit but end up generally compiling to the same thing. Closes #26581 (this supersedes the need for the option) Closes #27057 (this also starts ignoring the option)
2015-12-10Auto merge of #30267 - alexcrichton:tls-init-oh-my, r=nikomatsakisbors-1/+16
Due to #30228 it's not currently sound to do `*ptr = Some(value)`, so instead use `mem::replace` which fixes the soundness hole for now.
2015-12-09std: Rename thread::catch_panic to panic::recoverAlex Crichton-18/+1
This commit is an implementation of [RFC 1236] and [RFC 1323] which rename the `thread::catch_panic` function to `panic::recover` while also replacing the `Send + 'static` bounds with a new `PanicSafe` bound. [RFC 1236]: https://github.com/rust-lang/rfcs/pull/1236 [RFC 1323]: https://github.com/rust-lang/rfcs/pull/1323 cc #27719
2015-12-08std: Use mem::replace in TLS initializationAlex Crichton-1/+16
Due to #30228 it's not currently sound to do `*ptr = Some(value)`, so instead use `mem::replace` which fixes the soundness hole for now.
2015-12-04AsRawHandle and IntoRawHandle for JoinHandlePeter Atashian-0/+9
This allows users to get the HANDLE of a spawned thread on Windows Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+2
2015-11-18Add missing annotations and some testsVadim Petrochenkov-2/+9
2015-11-04Deprecate `_ms` functions that predate the `Duration` APIBen Striegel-0/+2
2015-10-30don't use drop_in_place as an intrinsicAlexis Beingessner-1/+1
2015-10-18Clean up thread::spawnarcnmx-23/+16
2015-10-02fix falloutAriel Ben-Yehuda-1/+2
looks like some mix of #18653 and `projection_must_outlive`, but that needs to be investigated further (crater run?)
2015-09-13Auto merge of #28339 - alexcrichton:stabilize-1.4, r=aturonbors-4/+2
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-11std: Internalize almost all of `std::rt`Alex Crichton-3/+4
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-4/+2
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-03Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`Vadim Petrochenkov-1/+2
2015-08-15std: Add issues to all unstable featuresAlex Crichton-72/+26
2015-08-14Auto merge of #27641 - nikomatsakis:soundness-rfc-1214, r=nrcbors-2/+2
This PR implements the majority of RFC 1214. In particular, it implements: - the new outlives relation - comprehensive WF checking For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run. There are some deviations from RFC 1214. Most notably: - we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing). - object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent. Both of those two issues are highlighted in the tracking issue, https://github.com/rust-lang/rust/issues/27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests. r? @nrc (or perhaps someone else?)
2015-08-12Fallout in libs -- misc missing bounds uncovered by WF checks.Niko Matsakis-2/+2
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-106/+4
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.