Docs and grammar
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed018ac..e95291e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# Version 2.1.0
+
+- Stronger gua
+
# Version 2.0.0
- Return `true` in `Task::run()`.
@@ -26,7 +30,7 @@
# Version 1.1.0
-- If a task is dropped or cancelled outside the `run` method, it gets re-scheduled.
+- If a task is dropped or canceled outside the `run` method, it gets re-scheduled.
- Add `spawn_local` constructor.
# Version 1.0.0
diff --git a/Cargo.toml b/Cargo.toml
index e9136d3..f8b0f9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,11 +1,11 @@
[package]
name = "async-task"
-version = "2.0.0"
+version = "2.1.0"
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
edition = "2018"
license = "Apache-2.0/MIT"
-repository = "https://github.com/async-rs/async-task"
-homepage = "https://github.com/async-rs/async-task"
+repository = "https://github.com/stjepang/async-task"
+homepage = "https://github.com/stjepang/async-task"
documentation = "https://docs.rs/async-task"
description = "Task abstraction for building executors"
keywords = ["futures", "task", "executor", "spawn"]
diff --git a/examples/panic-result.rs b/examples/panic-result.rs
index 6308240..b93f060 100644
--- a/examples/panic-result.rs
+++ b/examples/panic-result.rs
@@ -56,7 +56,7 @@
// Block on the future and report its result.
match executor::block_on(handle) {
- None => println!("The task was cancelled."),
+ None => println!("The task was canceled."),
Some(Ok(val)) => println!("The task completed with {:?}", val),
Some(Err(_)) => println!("The task has panicked"),
}
@@ -68,7 +68,7 @@
// Block on the future and report its result.
match executor::block_on(handle) {
- None => println!("The task was cancelled."),
+ None => println!("The task was canceled."),
Some(Ok(val)) => println!("The task completed with {:?}", val),
Some(Err(_)) => println!("The task has panicked"),
}
diff --git a/src/header.rs b/src/header.rs
index 5d808c7..a559e48 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -38,7 +38,7 @@
let mut state = self.state.load(Ordering::Acquire);
loop {
- // If the task has been completed or closed, it can't be cancelled.
+ // If the task has been completed or closed, it can't be canceled.
if state & (COMPLETED | CLOSED) != 0 {
break;
}
diff --git a/src/join_handle.rs b/src/join_handle.rs
index 10a189e..edf9fcd 100644
--- a/src/join_handle.rs
+++ b/src/join_handle.rs
@@ -13,7 +13,7 @@
///
/// This type is a future that resolves to an `Option<R>` where:
///
-/// * `None` indicates the task has panicked or was cancelled.
+/// * `None` indicates the task has panicked or was canceled.
/// * `Some(result)` indicates the task has completed with `result` of type `R`.
pub struct JoinHandle<R, T> {
/// A raw task pointer.
@@ -33,7 +33,7 @@
///
/// If the task has already completed, calling this method will have no effect.
///
- /// When a task is cancelled, its future will not be polled again.
+ /// When a task is canceled, its future will not be polled again.
pub fn cancel(&self) {
let ptr = self.raw_task.as_ptr();
let header = ptr as *const Header;
@@ -42,7 +42,7 @@
let mut state = (*header).state.load(Ordering::Acquire);
loop {
- // If the task has been completed or closed, it can't be cancelled.
+ // If the task has been completed or closed, it can't be canceled.
if state & (COMPLETED | CLOSED) != 0 {
break;
}
diff --git a/src/lib.rs b/src/lib.rs
index c1391a2..c4dea41 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -73,15 +73,18 @@
//! it's waiting for another future and needs to go to sleep. When woken up, its schedule function
//! will be invoked, pushing it back into the queue so that it can be run again.
//!
-//! # Cancellation
+//! # Cancelation
//!
-//! Both [`Task`] and [`JoinHandle`] have methods that cancel the task. When cancelled, the task's
+//! Both [`Task`] and [`JoinHandle`] have methods that cancel the task. When canceled, the task's
//! future will not be polled again and will get dropped instead.
//!
-//! If cancelled by the [`Task`] instance, the task is destroyed immediately. If cancelled by the
+//! If canceled by the [`Task`] instance, the task is destroyed immediately. If canceled by the
//! [`JoinHandle`] instance, it will be scheduled one more time and the next attempt to run it will
//! simply destroy it.
//!
+//! The `JoinHandle` future will then evaluate to `None`, but only after the task's future is
+//! dropped.
+//!
//! # Performance
//!
//! Task construction incurs a single allocation that holds its state, the schedule function, and
diff --git a/src/state.rs b/src/state.rs
index 167a371..58559ac 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -26,10 +26,10 @@
/// Set if the task is closed.
///
-/// If a task is closed, that means it's either cancelled or its output has been consumed by the
+/// If a task is closed, that means it's either canceled or its output has been consumed by the
/// `JoinHandle`. A task becomes closed when:
///
-/// 1. It gets cancelled by `Task::cancel()`, `Task::drop()`, or `JoinHandle::cancel()`.
+/// 1. It gets canceled by `Task::cancel()`, `Task::drop()`, or `JoinHandle::cancel()`.
/// 2. Its output gets awaited by the `JoinHandle`.
/// 3. It panics while polling the future.
/// 4. It is completed and the `JoinHandle` gets dropped.
diff --git a/src/task.rs b/src/task.rs
index d4da255..a300d63 100644
--- a/src/task.rs
+++ b/src/task.rs
@@ -180,8 +180,8 @@
/// function. In most executors, scheduling simply pushes the [`Task`] reference into a queue of
/// runnable tasks.
///
-/// If the [`Task`] reference is dropped without getting run, the task is automatically cancelled.
-/// When cancelled, the task won't be scheduled again even if a [`Waker`] wakes it. It is possible
+/// If the [`Task`] reference is dropped without getting run, the task is automatically canceled.
+/// When canceled, the task won't be scheduled again even if a [`Waker`] wakes it. It is possible
/// for the [`JoinHandle`] to cancel while the [`Task`] reference exists, in which case an attempt
/// to run the task won't do anything.
///
@@ -206,7 +206,7 @@
/// This is a convenience method that simply reschedules the task by passing it to its schedule
/// function.
///
- /// If the task is cancelled, this method won't do anything.
+ /// If the task is canceled, this method won't do anything.
pub fn schedule(self) {
let ptr = self.raw_task.as_ptr();
let header = ptr as *const Header;
@@ -226,12 +226,12 @@
/// available to the [`JoinHandle`]. And if the future is still pending, the task will have to
/// be woken up in order to be rescheduled and run again.
///
- /// If the task was cancelled by a [`JoinHandle`] before it gets run, then this method won't do
+ /// If the task was canceled by a [`JoinHandle`] before it gets run, then this method won't do
/// anything.
///
/// It is possible that polling the future panics, in which case the panic will be propagated
/// into the caller. It is advised that invocations of this method are wrapped inside
- /// [`catch_unwind`]. If a panic occurs, the task is automatically cancelled.
+ /// [`catch_unwind`]. If a panic occurs, the task is automatically canceled.
///
/// [`JoinHandle`]: struct.JoinHandle.html
/// [`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
@@ -245,7 +245,7 @@
/// Cancels the task.
///
- /// When cancelled, the task won't be scheduled again even if a [`Waker`] wakes it. An attempt
+ /// When canceled, the task won't be scheduled again even if a [`Waker`] wakes it. An attempt
/// to run it won't do anything.
///
/// [`Waker`]: https://doc.rust-lang.org/std/task/struct.Waker.html
diff --git a/tests/waker_ready.rs b/tests/waker_ready.rs
index a2223c6..7d1d59e 100644
--- a/tests/waker_ready.rs
+++ b/tests/waker_ready.rs
@@ -259,7 +259,7 @@
}
#[test]
-fn wake_cancelled() {
+fn wake_canceled() {
future!(f, waker, POLL, DROP_F);
schedule!(s, chan, SCHEDULE, DROP_S);
task!(task, _, f, s, DROP_T);