about summary refs log tree commit diff
path: root/library/std/src/thread
AgeCommit message (Collapse)AuthorLines
2021-03-27Use DebugStruct::finish_non_exhaustive() in std.Mara Bos-1/+4
2021-03-21Use io::Error::new_const everywhere to avoid allocations.Mara Bos-5/+5
2021-02-10Rollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-seYuki Okushi-0/+9
Clarify docs regarding sleep of zero duration Clarify that the behaviour of sleep() when given a duration of zero is actually platform specific.
2021-01-15Update library/std/src/thread/mod.rs James Wright-0/+1
Fix link reference Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-15Clarify difference between unix/windows behaviourJames Wright-0/+8
Updated to specify the underlying syscalls
2020-12-18Recommend panic::resume_unwind instead of panicking.Corey Farwell-7/+12
Fixes https://github.com/rust-lang/rust/issues/79950.
2020-11-22Drop support for cloudabi targetsLzu Tao-1/+0
2020-11-10Merge set_panic and set_print into set_output_capture.Mara Bos-3/+3
There were no use cases for setting them separately. Merging them simplifies some things.
2020-11-07Convert a bunch of intra-doc linksCamelid-2/+1
2020-10-22Capture output from threads spawned in testsTyler Mandry-0/+5
Fixes #42474.
2020-10-16Add std::thread::available_concurrencyYoshua Wuyts-0/+163
2020-10-02Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnayYuki Okushi-3/+2
Split sys_common::Mutex in StaticMutex and MovableMutex. The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`. 2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`. The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe. --- This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on #76932 for now.)~~ (See #77380.)
2020-09-27Move thread parker to sys_common.Mara Bos-224/+1
2020-09-27Add notes about memory ordering to futex parker implementation.Mara Bos-0/+20
2020-09-27Move linux-specific futex code into `sys` module.Mara Bos-36/+3
2020-09-27Fix warning.Mara Bos-1/+1
2020-09-27Mark unpark() as #[inline].Mara Bos-0/+2
2020-09-27Add fast futex-based thread parker for Linux.Mara Bos-123/+231
2020-09-27Move thread parker to a separate module.Mara Bos-112/+142
2020-09-27Split sys_common::Mutex in StaticMutex and MovableMutex.Mara Bos-3/+2
The (unsafe) Mutex from sys_common had a rather complicated interface. You were supposed to call init() manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if destroy() should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this Mutex, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither init() nor destroy() are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the LockGuard, never with raw_lock. 2. As a Boxed variable. In this case, both init() and destroy() are called, it will be moved and possibly used reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. The interface of both new types is now both safer and simpler. The first one does not call nor expose init/destroy, and the second one calls those automatically in its new() and Drop functions. Also, the locking functions of MovableMutex are no longer unsafe.
2020-09-26Auto merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-fn, ↵bors-44/+127
r=joshtriplett Std/thread: deny unsafe op in unsafe fn Partial fix of #73904. This encloses `unsafe` operations in `unsafe fn` in `libstd/thread`. `@rustbot` modify labels: F-unsafe-block-in-unsafe-fn
2020-09-22Update library functions with stability attributesDylan MacKenzie-0/+2
This may not be strictly minimal, but all unstable functions also need a `rustc_const_unstable` attribute.
2020-09-21Fix missing unsafe block for target arch wasm32Alexis Bourget-3/+10
2020-09-21Fix accordingly to reviewAlexis Bourget-22/+20
2020-09-21Improve some SAFETY comments following suggestionsAlexis Bourget-6/+17
2020-09-21Finished documenting all unsafe op inside unsafe fnAlexis Bourget-5/+17
2020-09-21Deny unsafe op in unsafe fns without the unsafe keyword, first part for ↵Alexis Bourget-36/+91
std/thread
2020-09-03Use inline(never) instead of coldHoward Su-3/+2
inline(never) is better way to avoid optimizer to inline the function instead of cold.
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-470/+465
Also doing fmt inplace as requested.
2020-08-20Move to intra doc links for std::thread documentationAlexis Bourget-87/+40
2020-07-29Disallow missing unsafe blocks in unsafe fn in panicking.rsAlexis Bourget-1/+5
This adds SAFETY comments where necessary, explaining the preconditions and how they are respected.
2020-07-27mv std libs to library/mark-0/+2534