about summary refs log tree commit diff
path: root/src/liballoc/task.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-91/+0
2020-07-14Remove unnecessary type hints from the Wake implYoshua Wuyts-3/+2
2020-06-19`#[deny(unsafe_op_in_unsafe_fn)]` in liballocLeSeulArtichaut-4/+5
2020-05-07Add Arc::{incr,decr}_strong_countYoshua Wuyts-5/+7
2020-04-03Fix link in task::Wake docsYoshua Wuyts-2/+4
2020-03-23Apply suggestions from code reviewSaoirse Shipwreckt-5/+5
Co-Authored-By: Ashley Mannix <ashleymannix@live.com.au>
2020-03-23Update src/liballoc/task.rsSaoirse Shipwreckt-1/+1
Co-Authored-By: Ashley Mannix <ashleymannix@live.com.au>
2020-03-23More explicit; CFG on atomic pointerWithout Boats-3/+3
2020-03-23typoWithout Boats-1/+1
2020-03-23Improve safety implementation, fix typosWithout Boats-16/+12
2020-03-23Add Wake trait for safe construction of Wakers.Without Boats-0/+91
Currently, constructing a waker requires calling the unsafe `Waker::from_raw` API. This API requires the user to manually construct a vtable for the waker themself - which is both cumbersome and very error prone. This API would provide an ergonomic, straightforward and guaranteed memory-safe way of constructing a waker. It has been our longstanding intention that the `Waker` type essentially function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two considerations prevented the original API from being shipped as simply an `Arc<dyn Wake>`: - We want to support futures on embedded systems, which may not have an allocator, and in optimized executors for which this API may not be best-suited. Therefore, we have always explicitly supported the maximally-flexible (but also memory-unsafe) `RawWaker` API, and `Waker` has always lived in libcore. - Because `Waker` lives in libcore and `Arc` lives in liballoc, it has not been feasible to provide a constructor for `Waker` from `Arc<dyn Wake>`. Therefore, the Wake trait was left out of the initial version of the task waker API. However, as Rust 1.41, it is possible under the more flexible orphan rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc. Therefore, we can now define this constructor even though `Waker` lives in libcore. This PR adds these APIs: - A `Wake` trait, which contains two methods - A required method `wake`, which is called by `Waker::wake` - A provided method `wake_by_ref`, which is called by `Waker::wake_by_ref` and which implementors can override if they can optimize this use case. - An implementation of `From<Arc<W>> for Waker where W: Wake + Send + Sync + 'static` - A similar implementation of `From<Arc<W>> for RawWaker`.
2019-02-03Update the future/task APIMatthias Einwag-130/+0
This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592. Changes: - Replacing UnsafeWake with RawWaker and RawWakerVtable - Removal of LocalWaker - Removal of Arc-based Wake trait
2019-02-03liballoc: revert nested imports style changes.Mazdak Farrokhzad-5/+3
2019-02-02liballoc: apply uniform_paths.Mazdak Farrokhzad-1/+1
2019-02-02liballoc: refactor & fix some imports.Mazdak Farrokhzad-3/+5
2019-02-02liballoc: cargo check passes on 2018Mazdak Farrokhzad-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-08-01Switch to bootstrapping from 1.29 betaMark Rousskov-12/+3
2018-07-05#[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")]Jorge Aparicio-6/+12
2018-07-05enable Atomic*.{load,store} for ARMv6-M / MSP430Jorge Aparicio-3/+6
closes #45085 this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]` attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS natively, like MSP430 and ARMv6-M.
2018-06-29Rename alloc::arc to alloc::sync, to match std::syncSimon Sapin-1/+1
2018-06-06Add Future and task system to the standard libraryTaylor Cramer-0/+140