about summary refs log tree commit diff
path: root/src/libstd/thread
AgeCommit message (Collapse)AuthorLines
2017-10-27Auto merge of #45285 - alexcrichton:update-bootstrap, r=Mark-Simulacrumbors-5/+0
Bump to 1.23 and update bootstrap This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-5/+0
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-25std: Optimize thread park/unpark implementationAlex Crichton-15/+72
This is an adaptation of alexcrichton/futures-rs#597 for the standard library. The goal here is to avoid locking a mutex on the "fast path" for thread park/unpark where you're waking up a thread that isn't sleeping or otherwise trying to park a thread that's already been notified. Mutex performance varies quite a bit across platforms so this should provide a nice consistent speed boost for the fast path of these functions.
2017-10-17Docs: a LocalKey might start in the Valid stateStjepan Glavina-1/+4
2017-10-08Don't encourage people to ignore threading errors in the docsJake Goulding-5/+7
2017-09-18Rollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnikAlex Crichton-0/+7
Document thread builder panics for nul bytes in thread names This seems to have been undocumented. Mention this where the name is set (Builder::name) and where the panic could happen (Builder::spawn). Thread::new is private and I think the builder is the only user where this matters. A short comment was added to "document" Thread::new too.
2017-09-17std: Document thread builder panics for nul bytes in thread namesUlrik Sverdrup-0/+7
This seems to have been undocumented. Mention this where the name is set (Builder::name) and where the panic could happen (Builder::spawn). Thread::new is private and I think the builder is the only user where this matters. A short comment was added to "document" Thread::new too.
2017-09-14Auto merge of #43972 - TobiasSchaffner:std_clean, r=alexcrichtonbors-2/+2
Add the libstd-modifications needed for the L4Re target This commit adds the needed modifications to compile the std crate for the L4 Runtime environment (L4Re). A target for the L4Re was introduced in commit: c151220a84e40b65e45308cc0f3bbea4466d3acf In many aspects implementations for linux also apply for the L4Re microkernel. Some uncommon characteristics had to be resolved: * L4Re has no network funktionality * L4Re has a maximum stacksize of 1Mb for threads * L4Re has no uid or gid Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
2017-09-13Move default stack min size to thread implementationsTobias Schaffner-2/+2
The default min stack size value is smaller on l4re and therefore this value has to be different depending on the platform.
2017-09-07std::thread::LocalKey: Document limitation with initializersJoshua Liebow-Feeser-0/+4
2017-09-04Make the LocalKey facade of thread_local! inlineable cross-crate.Eduard-Mihai Burtescu-3/+13
2017-08-31Update bootstrap compilerAlex Crichton-4/+1
This commit updates the bootstrap compiler and clears out a number of #[cfg(stage0)] annotations and related business
2017-08-27Auto merge of #44112 - alexcrichton:thread-join, r=sfacklerbors-0/+5
std: Handle OS errors when joining threads Also add to the documentation that the `join` method can panic. cc #34971 cc #43539
2017-08-26std: Handle OS errors when joining threadsAlex Crichton-0/+5
Also add to the documentation that the `join` method can panic. cc #34971 cc #43539
2017-08-24Fix inconsistent doc headingslukaramu-1/+1
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
2017-08-22Thread spawning: don't run `min_stack` if the user has specified stack size.Corey Farwell-1/+1
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-08-14Indicate which stack size option has precedence.Corey Farwell-1/+1
2017-08-13Indicate thread names get passed to the OS.Corey Farwell-4/+8
2017-08-13Rewrite docs for stack size/thread names for spawned threads.Corey Farwell-10/+41
* Moves docs about stack size and thread naming from `Builder` to the `std::thread` module * Adds more links to the new module-level documentation * Mentions the 2 MiB stack size default, but indicate it's subject to change Fixes https://github.com/rust-lang/rust/issues/43805.
2017-08-12Auto merge of #43746 - eddyb:sound-thread-local, r=alexcrichtonbors-31/+31
Check #[thread_local] statics correctly in the compiler. Fixes #43733 by introducing `#[allow_internal_unsafe]` analogous to `#[allow_internal_unstable]`, for letting a macro expand to `unsafe` blocks and functions even in `#![forbid(unsafe_code)]` crates. Fixes #17954 by not letting references to `#[thread_local]` statics escape the function they're taken in - we can't just use a magical lifetime because Rust has *lifetime parametrism*, so if we added the often-proposed `'thread` lifetime, we'd have no way to check it in generic code. To avoid potential edge cases in the compiler, the lifetime is actually that of a temporary at the same position, i.e. `&TLS_STATIC` has the same lifetime `&non_const_fn()` would. Referring to `#[thread_local]` `static`s at compile-time is banned now (as per PR discussion). Additionally, to remove `unsafe impl Sync` from `std::thread::local::fast::Key`, `#[thread_local]` statics are now not required to implement `Sync`, as they are not shared between threads.
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-31/+31
2017-08-11Fix some typosBastien Orivel-1/+1
2017-08-02Indicate how `ThreadId` is created.Corey Farwell-1/+5
2017-08-02Fix broken links in `Thread` docs.Corey Farwell-0/+3
2017-07-26Rollup merge of #43456 - joshlf:spawn-doc-grammar, r=alexcrichtonMark Simulacrum-1/+1
std::thread::spawn: Fix grammar in documentation Closes #43435.
2017-07-25Bump master to 1.21.0Alex Crichton-67/+0
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-24std::thread::spawn: Fix grammar in documentationJoshua Liebow-Feeser-1/+1
2017-07-23Fix some doc/comment typos.Bruce Mitchener-4/+4
2017-07-15Auto merge of #43185 - durka:thread-local-pub-restricted, r=alexcrichtonbors-1/+57
support pub(restricted) in thread_local! (round 2) Resurrected #40984 now that the issue blocking it was fixed. Original description: `pub(restricted)` was stabilized in #40556 so let's go! Here is a [playground](https://play.rust-lang.org/?gist=f55f32f164a6ed18c219fec8f8293b98&version=nightly&backtrace=1). I changed the interface of `__thread_local_inner!`, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov @jseyfried), so this may be an issue.
2017-07-12Use try_with for with implementationLee Bousfield-9/+2
2017-07-11stage0 fallbackAlex Burka-0/+67
2017-07-11use :vis in thread_local!Alex Burka-30/+8
2017-07-11support pub(restricted) in thread_local!Alex Burka-32/+43
2017-07-11Fix @alexcrichton commentsLee Bousfield-1/+1
2017-07-10Add LocalKey::try_with as an alternative to stateLee Bousfield-0/+52
2017-06-24Stabilize ThreadIdSteven Fackler-8/+2
Closes #21507
2017-06-23rustc: Enable #[thread_local] for WindowsAlex Crichton-4/+80
I think LLVM has had support for quite some time now for this, we just never got around to testing it out and binding it. We've had some trouble landing this in the past I believe, but it's time to try again! This commit flags the `#[thread_local]` attribute as being available for Windows targets and adds an implementation of `register_dtor` in the `thread::local` module to ensure we can destroy these keys. The same functionality is implemented in clang via a function called `__tlregdtor` (presumably provided in some Windows runtime somewhere), but this function unfortunately does not take a data pointer (just a thunk) which means we can't easily call it. For now destructors are just run in the same way the Linux fallback is implemented, which is just keeping track via a single OS-based TLS key.
2017-06-12Capture elapsed duration in Thread::park_timeout exampleMark Buer-5/+9
2017-06-02Rollup merge of #41981 - gamazeps:thread-detach, r=frewsxcvMark Simulacrum-3/+28
[Doc] Expands `detach` documentation in `thread::JoinHande`. Part of #29378 . - Adds an example of a thread detaching. - Expands what `detaching` means. r? @steveklabnik
2017-06-02Expands `detach` documentation in `thread::JoinHande`.Felix Raimundo-3/+28
Part of #29378 . - Adds an example of a thread detaching. - Expands what `detaching` means.
2017-05-24Rollup merge of #42141 - ids1024:nobacktrace, r=aturonMark Simulacrum-0/+3
Fix building std without backtrace feature, which was broken in ca8b754 Fixes #42139
2017-05-24Rollup merge of #41980 - gamazeps:thread-send, r=steveklabnikMark Simulacrum-0/+22
[Doc] Add `'static` and `Send` constraints explanations to `thread::spawn` Part of #29378. Explains why the constraints on the closure and its return value are `'static` and `Send`. Allows to tick of `thread::spawn` from the list of things to document in the `thread` module. r? @steveklabnik
2017-05-21Fix building without backtrace feature, which was broken in ca8b754Ian Douglas Scott-0/+3
Fixes #42139
2017-05-16Rollup merge of #41995 - gamazeps:thread-localkey, r=frewsxcvMark Simulacrum-15/+30
[Doc] Add links to the `thread::LocalKey` doc. Part of #29378 . I do not know exactly what should be done for the `cleanup` part, if you have any idea I'll gladly do it. r? @rust-lang/docs
2017-05-16Rollup merge of #41994 - gamazeps:thread-builder, r=GuillaumeGomezMark Simulacrum-11/+38
[Doc] Implrove `thread::Builder`'s doc. Part of #29378 . - Explains *why* we would use the builder instead ofthe free function. - Changes the parent-child explanation for a spawned-caller in `thread::Builder::spawn` - Adds a link to `io::Result` in `thread::Builder` - Corrects the return type doc in `thread::Builder::spawn` r? @rust-lang/docs
2017-05-15Add links to the `thread::LocalKey` doc.Felix Raimundo-15/+30
Part of #29378 .
2017-05-14Improve `thread::Builder` documentation.Felix Raimundo-11/+38
Part of #29378 . - In particular explains *why* we would use the builder instead of the free function. - Changes the parent-child explanation for a spawned-caller. - Add link to `io::Result` in `thread::Builder` - Corrects the `thread::Builder::spawn` documentation.