about summary refs log tree commit diff
path: root/src/libstd/sync
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-8854/+0
2020-07-17Rollup merge of #72414 - KodrAus:feat/stdlazy, r=Mark-SimulacrumManish Goregaokar-4/+17
Add lazy initialization primitives to std Follow-up to #68198 Current RFC: https://github.com/rust-lang/rfcs/pull/2788 Rebased and fixed up a few of the dangling comments. Some notes carried over from the previous PR: - [ ] Naming. I'm ok to just roll with the `Sync` prefix like `SyncLazy` for now, but [have a personal preference for `Atomic`](https://github.com/rust-lang/rfcs/pull/2788#issuecomment-574466983) like `AtomicLazy`. - [x] [Poisoning](https://github.com/rust-lang/rfcs/pull/2788#discussion_r366725768). It seems like there's [some regret around poisoning in other `std::sync` types that we might want to just avoid upfront for `std::lazy`, especially if that would align with a future `std::mutex` that doesn't poison](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/parking_lot.3A.3AMutex.20in.20std/near/190331199). Personally, if we're adding these types to `std::lazy` instead of `std::sync`, I'd be on-board with not worrying about poisoning in `std::lazy`, and potentially deprecating `std::sync::Once` and `lazy_static` in favour of `std::lazy` down the track if it's possible, rather than attempting to replicate their behavior. cc @Amanieu @sfackler. - [ ] [Consider making`SyncOnceCell::get` blocking](https://github.com/matklad/once_cell/pull/92). There doesn't seem to be consensus in the linked PR on whether or not that's strictly better than the non-blocking variant. In general, none of these seem to be really blocking an initial unstable merge, so we could possibly kick off a FCP if y'all are happy? cc @matklad @pitdicker have I missed anything, or were there any other considerations that have come up since we last looked at this?
2020-07-16Rollup merge of #73269 - mzohreva:mz/sgx-wait-timeout, r=jethrogbManish Goregaokar-13/+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-17appease tidyAshley Mannix-1/+4
2020-07-17remove inlined lazy::Waiter in favor of sync::OnceAshley Mannix-4/+14
2020-06-15Rollup merge of #73104 - poliorcetics:explicit-mutex-drop-example, r=dtolnayRalf Jung-0/+54
Example about explicit mutex dropping Fixes #67457. Following the remarks made in #73074, I added an example on the main `Mutex` type, with a situation where there is mutable data and a computation result. In my testing it is effectively needed to explicitly drop the lock, else it deadlocks. r? @dtolnay because you were the one to review the previous PR.
2020-06-13Rewrap comments in Mutex exampleDavid Tolnay-11/+11
2020-06-13Clarify the scope-related explanation Poliorcetics-3/+2
Based on the review made by dtolnay.
2020-06-13Apply suggestions from code reviewPoliorcetics-5/+5
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-12Enable some timeouts in SGX platformMohsen Zohrevandi-13/+0
This would partially resolve https://github.com/fortanix/rust-sgx/issues/31
2020-06-10Migrate to numeric associated constsLzu Tao-3/+1
2020-06-09Remove a lot of unecessary/duplicated commentsAlexis Bourget-11/+3
2020-06-08Simply use drop instead of std::mem::dropPoliorcetics-2/+2
Co-authored-by: LeSeulArtichaut <leseulartichaut@gmail.com>
2020-06-07Improved the example to work with mutable data, providing a reason for the ↵Alexis Bourget-4/+6
mutex holding it
2020-06-07Added an example where explicitly dropping a lock is necessary/a good idea.Alexis Bourget-0/+61
2020-06-03Bump to 1.46Mark Rousskov-10/+2
2020-05-24Fix typo in doc comment.Eitan Mosenkis-1/+1
call_one_force -> call_once_force
2020-05-17make abort intrinsic safe, and correct its documentationRalf Jung-0/+4
2020-05-03Rollup merge of #71398 - ThinkChaos:feat_refcell_take, r=LukasKalbertodtDylan DPC-1/+1
Add `RefCell::take` Add `RefCell::take` to match `Cell` and `Option`. I also changed a couple of calls to `.replace` to `.take`. Tracking issue is #71395. This is my first contribution, please tell me if there's anything I could improve, thanks!
2020-04-26Use Cell::take in a couple placesThinkChaos-1/+1
2020-04-26fix more clippy warningsMatthias Krüger-1/+1
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-24Avoid unused Option::map resultsJosh Stone-5/+11
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-22More diagnostic items for Clippy usagePhilipp Hansch-0/+1
This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types.
2020-04-16Dogfood or_patterns in the standard libraryJosh Stone-2/+2
2020-04-05Stop importing integer modules in libstdLinus Färnstrand-3/+0
2020-03-15Fix "since" field for `Once::is_complete`'s `#[stable]` attributeLukas Kalbertodt-1/+1
It was accidentally merged with the wrong version.
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-1/+1
fix various typos
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-6/+3
2020-03-06fix various typosMatthias Krüger-1/+1
2020-02-07Stabilize Once::is_completedMichael Bradshaw-6/+5
2020-01-14Auto merge of #67076 - mbrubeck:condvar, r=dtolnaybors-43/+34
Stabilize Condvar::wait_while and wait_timeout_while (previously wait_until, wait_timeout_until) Closes #47960.
2020-01-08Use matches macro in libcore and libstdIgor Aleksanov-10/+2
2019-12-28Rollup merge of #67632 - kraai:remove-collapsed-reference-links, r=steveklabnikOliver Scherer-5/+5
Convert collapsed to shortcut reference links
2019-12-26Rename wait_until/wait_timeout_until to wait_while/white_timeout_whileMatt Brubeck-36/+32
2019-12-26Stabilize Condvar::wait_until and wait_timeout_untilMatt Brubeck-7/+2
2019-12-26Convert collapsed to shortcut reference linksMatthew Kraai-5/+5
2019-12-26Remove redundant link textsMatthew Kraai-1/+1
2019-12-24Deprecate Error::description for realDavid Tolnay-0/+5
`description` has been documented as soft-deprecated since 1.27.0 (17 months ago). There is no longer any reason to call it or implement it. This commit: - adds #[rustc_deprecated(since = "1.41.0")] to Error::description; - moves description (and cause, which is also deprecated) below the source and backtrace methods in the Error trait; - reduces documentation of description and cause to take up much less vertical real estate in rustdocs, while preserving the example that shows how to render errors without needing to call description; - removes the description function of all *currently unstable* Error impls in the standard library; - marks #[allow(deprecated)] the description function of all *stable* Error impls in the standard library; - replaces miscellaneous uses of description in example code and the compiler.
2019-12-22Format the worldMark Rousskov-112/+121
2019-12-18Propagate cfg bootstrapMark Rousskov-1/+1
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+1
functions with a `const` modifier
2019-12-06get rid of __ in field namesRalf Jung-26/+24
2019-11-29Format libstd with rustfmtDavid Tolnay-485/+499
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-09Run rustfmt on libstd/sync/once.rsPaul Dicker-32/+29
2019-11-05Don't mutate node.nextPaul Dicker-36/+34
2019-10-25Mention park guaranteePaul Dicker-0/+4
2019-10-24Always align Waiter to 4 bytesPaul Dicker-0/+1
2019-10-24Use more precise atomic orderingsPaul Dicker-12/+41
2019-10-24In Waiter use interior mutability for threadPaul Dicker-9/+19
2019-10-24Reduce the amount of comments in call_innerPaul Dicker-19/+6