summary refs log tree commit diff
path: root/src/libstd/thread
AgeCommit message (Collapse)AuthorLines
2020-01-06Add an unstable conversion from thread ID to u64Mark Rousskov-0/+13
We see multiple cases inside rustc and ecosystem code where ThreadId is transmuted to u64, exploiting the underlying detail. This is suboptimal (can break unexpectedly if we change things in std). It is unlikely that ThreadId will ever need to be larger than u64 -- creating even 2^32 threads over the course of a program is quite hard, 2^64 is even harder. As such, we do not choose to return a larger sized type (e.g. u128). If we choose to shrink ThreadId in the future, or otherwise change its internals, it is likely that a mapping to u64 will still be applicable (though may become more complex).
2019-12-22Format the worldMark Rousskov-80/+99
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-6/+6
2019-11-29Format libstd with rustfmtDavid Tolnay-54/+49
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-11-07Rollup merge of #66146 - 3442853561:patch-2, r=Mark-SimulacrumYuki Okushi-2/+2
Remove unused parameters in `__thread_local_inner` Fixes #65993.
2019-11-07Try with crate::error::ErrorPyry Kontio-1/+1
2019-11-06Update local.rs3442853561-2/+2
Removed parameters not used in the macro
2019-11-06Fix the Error linking.Pyry Kontio-1/+1
2019-11-06Addressed review comments.Pyry Kontio-6/+6
2019-11-05Improve std::thread::Result documentationPyry Kontio-0/+12
2019-10-22Apply clippy::single_match suggestionMateusz MikuĊ‚a-3/+2
2019-10-05Rollup merge of #64765 - alexcrichton:less-check-backtrace, r=sfacklerTyler Mandry-3/+0
std: Reduce checks for `feature = "backtrace"` This is a stylistic change to libstd to reduce the number of checks of `feature = "backtrace"` now that we unconditionally depend on the `backtrace` crate and rely on it having an empty implementation. otherwise.
2019-09-25std: Reduce checks for `feature = "backtrace"`Alex Crichton-3/+0
This is a stylistic change to libstd to reduce the number of checks of `feature = "backtrace"` now that we unconditionally depend on the `backtrace` crate and rely on it having an empty implementation. otherwise.
2019-09-16updated the panic message wordingTomas Tauber-1/+1
2019-09-15Made a thread local storage panic message more explanatoryTomas Tauber-2/+2
(TLS is usually understood as Transport Layer Security outside rust-std internals)
2019-08-05Auto merge of #61491 - stjepang:impls-for-accesserror, r=dtolnaybors-0/+5
Add a few trait impls for AccessError
2019-08-04Add #[stable] to Error implStjepan Glavina-0/+1
2019-07-27Remove run-pass test suitesVadim Petrochenkov-1/+1
2019-06-20Add a few trait impls for AccessErrorStjepan Glavina-0/+4
2019-06-20Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichtonbors-107/+183
macos tlv workaround fixes: #60141 Includes: * remove dead code: `requires_move_before_drop`. This hasn't been needed for a while now (oops I should have removed it in #57655) * redox had a copy of `fast::Key` (not sure why?). That has been removed. * Perform a `read_volatile` on OSX to reduce `tlv_get_addr` calls per `__getit` from (4-2 depending on context) to 1. `tlv_get_addr` is relatively expensive (~1.5ns on my machine). Previously, in contexts where `__getit` was inlined, 4 calls to `tlv_get_addr` were performed per lookup. For some reason when `__getit` is not inlined this is reduced to 2x - and performance improves to match. After this PR, I have only ever seen 1x call to `tlv_get_addr` per `__getit`, and macos now benefits from situations where `__getit` is inlined. I'm not sure if the `read_volatile(&&__KEY)` trick is working around an LLVM bug, or a rustc bug, or neither. r? @alexcrichton
2019-05-15fix wasm unused import in thread local implementationtyler-1/+0
2019-05-15llvm makes good inlining choices with only the #[cold] attributetyler-19/+15
2019-05-15remove trailing whitespacetyler-1/+1
2019-05-15cold was necessary on try_initialize_nodrop to get more straight line asmtyler-0/+1
2019-05-15- remove unnecessary inlinestyler-21/+18
- add comment explaining that the fast::Key data structure was carefully constructed for fast access on OSX - remove inline(never) from the initializer for types where `needs_drop::<T>()` is false
2019-05-15add #[allow(unused)]tyler-0/+1
2019-05-15restructure thread_local! for better codegen (especially on macos)tyler-97/+188
2019-05-15Revert "ensure fast thread local lookups occur once per access on macos"tyler-6/+5
This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
2019-05-15ensure fast thread local lookups occur once per access on macostyler-5/+6
2019-05-15remove dead code: requires_move_before_droptyler-12/+3
2019-05-04Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo-0/+1
2019-04-18Use more realistic example for thread builderAleksey Kladov-1/+1
Stack size of 10 **bytes** does not make any sense: the minimal possible stack size is greater anyway.
2019-04-10Eliminate `FnBox` usages from libstd.CrLF0710-2/+3
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-8/+8
2019-03-27Rollup merge of #59460 - xfix:include-id-in-thread-debug, r=AmanieuJosh Stone-1/+4
Include id in Thread's Debug implementation Since Rust 1.19.0, `id` is a stable method, so there is no reason to not include it in Debug implementation.
2019-03-27Include id in Thread's Debug implementationKonrad Borowski-1/+4
Since Rust 1.19.0, id is a stable method, so there is no reason to not include it in Debug implementation.
2019-03-26Auto merge of #59136 - jethrogb:jb/sgx-std-test, r=sanxiynbors-4/+7
SGX target: fix std unit tests This fixes some tests and some code in the SGX sys implementation to make the `std` unit test suite pass. #59009 must be merged first.
2019-03-25SGX target: fix std unit testsJethro Beekman-4/+7
2019-03-20Add a test for size_of Option<ThreadId>Simon Sapin-1/+7
2019-03-19Make Option<ThreadId> no larger than ThreadId, with NonZeroU64Simon Sapin-3/+4
2019-03-03race condition in thread local storage examplebenaryorg-1/+4
The example had a potential race condition that would still pass the test. If the thread which was supposed to modify it's own thread local was slower than the instruction to modify in the main thread, then the test would pass even in case of a failure. This is would be minor if the child thread was waited for since it check using an `assert_eq` for the same thing, but vice versa. However, if the `assert_eq` failed this would trigger a panic, which is not at all caught by the example since the thread is not waited on. Signed-off-by: benaryorg <binary@benary.org>
2019-03-02Bootstrap compiler update for 1.35 releaseMark Rousskov-6/+2
2019-02-28libstd => 2018Taiki Endo-52/+52
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-1/+1
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-2/+6
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-01-22Print a slightly clearer message when failing to spawn a threadJethro Beekman-1/+1
2019-01-15OSX: fix #57534 registering thread dtors while running thread dtorstyler-7/+1
2018-12-25Remove licensesMark Rousskov-20/+0
2018-12-10Auto merge of #56157 - RalfJung:park, r=nagisabors-5/+22
expand thread::park explanation Cc @carllerche @parched @stjepang