about summary refs log tree commit diff
path: root/src/libstd/thread
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-2534/+0
2020-07-16Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogbManish Goregaokar-3/+0
Enable some timeouts in SGX platform This would partially resolve https://github.com/fortanix/rust-sgx/issues/31 cc @jethrogb and @Goirad
2020-07-14Rollup merge of #74263 - RalfJung:thread-local, r=Mark-SimulacrumManish Goregaokar-2/+2
Slight reorganization of sys/(fast_)thread_local I was long confused by the `thread_local` and `fast_thread_local` modules in the `sys(_common)` part of libstd. The names make it *sound* like `fast_thread_local` is just a faster version of `thread_local`, but really these are totally different APIs: one provides thread-local "keys", which are non-addressable pointer-sized pieces of local storage with an associated destructor; the other (the "fast" one) provides just a destructor. So I propose we rename `fast_thread_local` to `thread_local_dtor`, and `thread_local` to `thread_local_key`. That's what this PR does.
2020-07-12Remove the useless indentationLzu Tao-3/+2
2020-07-12rename fast_thread_local -> thread_local_dtor; thread_local -> thread_local_keyRalf Jung-2/+2
2020-06-12Enable some timeouts in SGX platformMohsen Zohrevandi-3/+0
This would partially resolve https://github.com/fortanix/rust-sgx/issues/31
2020-06-10Migrate to numeric associated constsLzu Tao-1/+0
2020-05-12Warn against thread::sleep in async fnKornel-0/+4
2020-05-11Fix clippy warningsMatthias Krüger-1/+1
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-04-22Rollup merge of #71256 - cuviper:must_use_replace, r=estebankDylan DPC-1/+1
Lint must_use on mem::replace This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
2020-04-20Stop accessing module level int consts via crate::<Ty>Linus Färnstrand-1/+1
2020-04-17Fix unused results from mem::replaceJosh Stone-1/+1
2020-03-30Add inline attributes for functions used in the query systemJohn Kåre Alsaker-0/+1
2020-03-21Return NonZeroU64 from ThreadId::as_u64.Thomas Bächler-2/+2
As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which can then be stored inside an AtomicU64.
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.