summaryrefslogtreecommitdiff
path: root/src/libstd/thread
Commit message (Collapse)AuthorAgeFilesLines
* mv std libs to library/mark2020-07-272-2534/+0
|
* Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogbManish Goregaokar2020-07-161-3/+0
|\ | | | | | | | | | | | | | | Enable some timeouts in SGX platform This would partially resolve https://github.com/fortanix/rust-sgx/issues/31 cc @jethrogb and @Goirad
| * Enable some timeouts in SGX platformMohsen Zohrevandi2020-06-121-3/+0
| | | | | | | | | | This would partially resolve https://github.com/fortanix/rust-sgx/issues/31
* | Rollup merge of #74263 - RalfJung:thread-local, r=Mark-SimulacrumManish Goregaokar2020-07-141-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.
| * | rename fast_thread_local -> thread_local_dtor; thread_local -> thread_local_keyRalf Jung2020-07-121-2/+2
| | |
* | | Remove the useless indentationLzu Tao2020-07-121-3/+2
|/ /
* | Migrate to numeric associated constsLzu Tao2020-06-101-1/+0
|/
* Warn against thread::sleep in async fnKornel2020-05-121-0/+4
|
* Fix clippy warningsMatthias Krüger2020-05-111-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}
* Rollup merge of #71256 - cuviper:must_use_replace, r=estebankDylan DPC2020-04-221-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`.
| * Fix unused results from mem::replaceJosh Stone2020-04-171-1/+1
| |
* | Stop accessing module level int consts via crate::<Ty>Linus Färnstrand2020-04-201-1/+1
|/
* Add inline attributes for functions used in the query systemJohn Kåre Alsaker2020-03-301-0/+1
|
* Return NonZeroU64 from ThreadId::as_u64.Thomas Bächler2020-03-211-2/+2
| | | | | As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which can then be stored inside an AtomicU64.
* Add an unstable conversion from thread ID to u64Mark Rousskov2020-01-061-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).
* Format the worldMark Rousskov2019-12-221-80/+99
|
* Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur2019-12-212-6/+6
|
* Format libstd with rustfmtDavid Tolnay2019-11-291-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
* Rollup merge of #66146 - 3442853561:patch-2, r=Mark-SimulacrumYuki Okushi2019-11-071-2/+2
|\ | | | | | | | | | | Remove unused parameters in `__thread_local_inner` Fixes #65993.
| * Update local.rs34428535612019-11-061-2/+2
| | | | | | Removed parameters not used in the macro
* | Try with crate::error::ErrorPyry Kontio2019-11-071-1/+1
| |
* | Fix the Error linking.Pyry Kontio2019-11-061-1/+1
| |
* | Addressed review comments.Pyry Kontio2019-11-061-6/+6
| |
* | Improve std::thread::Result documentationPyry Kontio2019-11-051-0/+12
|/
* Apply clippy::single_match suggestionMateusz Mikuła2019-10-221-3/+2
|
* Rollup merge of #64765 - alexcrichton:less-check-backtrace, r=sfacklerTyler Mandry2019-10-051-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.
| * std: Reduce checks for `feature = "backtrace"`Alex Crichton2019-09-251-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.
* | updated the panic message wordingTomas Tauber2019-09-161-1/+1
| |
* | Made a thread local storage panic message more explanatoryTomas Tauber2019-09-151-2/+2
|/ | | | | (TLS is usually understood as Transport Layer Security outside rust-std internals)
* Auto merge of #61491 - stjepang:impls-for-accesserror, r=dtolnaybors2019-08-051-0/+5
|\ | | | | | | Add a few trait impls for AccessError
| * Add #[stable] to Error implStjepan Glavina2019-08-041-0/+1
| |
| * Add a few trait impls for AccessErrorStjepan Glavina2019-06-201-0/+4
| |
* | Remove run-pass test suitesVadim Petrochenkov2019-07-271-1/+1
|/
* Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichtonbors2019-06-201-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
| * fix wasm unused import in thread local implementationtyler2019-05-151-1/+0
| |
| * llvm makes good inlining choices with only the #[cold] attributetyler2019-05-151-19/+15
| |
| * remove trailing whitespacetyler2019-05-151-1/+1
| |
| * cold was necessary on try_initialize_nodrop to get more straight line asmtyler2019-05-151-0/+1
| |
| * - remove unnecessary inlinestyler2019-05-151-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
| * add #[allow(unused)]tyler2019-05-151-0/+1
| |
| * restructure thread_local! for better codegen (especially on macos)tyler2019-05-151-97/+188
| |
| * Revert "ensure fast thread local lookups occur once per access on macos"tyler2019-05-151-6/+5
| | | | | | | | This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
| * ensure fast thread local lookups occur once per access on macostyler2019-05-151-5/+6
| |
| * remove dead code: requires_move_before_droptyler2019-05-151-12/+3
| |
* | Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo2019-05-041-0/+1
|/
* Use more realistic example for thread builderAleksey Kladov2019-04-181-1/+1
| | | Stack size of 10 **bytes** does not make any sense: the minimal possible stack size is greater anyway.
* Eliminate `FnBox` usages from libstd.CrLF07102019-04-101-2/+3
|
* libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad2019-03-312-8/+8
|
* Rollup merge of #59460 - xfix:include-id-in-thread-debug, r=AmanieuJosh Stone2019-03-271-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.
| * Include id in Thread's Debug implementationKonrad Borowski2019-03-271-1/+4
| | | | | | | | | | Since Rust 1.19.0, id is a stable method, so there is no reason to not include it in Debug implementation.