Canonicalize to US spelling of "cancelation"

This commit is contained in:
Jonas Schievink 2021-05-18 15:36:43 +02:00
parent 877d3f20d1
commit 223f87bb18
9 changed files with 46 additions and 46 deletions

View file

@ -282,9 +282,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
See `{fn_name}` for details.
*Note:* Setting values will trigger cancellation
*Note:* Setting values will trigger cancelation
of any ongoing queries; this method blocks until
those queries have been cancelled.
those queries have been canceled.
",
fn_name = fn_name
);
@ -296,9 +296,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
See `{fn_name}` for details.
*Note:* Setting values will trigger cancellation
*Note:* Setting values will trigger cancelation
of any ongoing queries; this method blocks until
those queries have been cancelled.
those queries have been canceled.
",
fn_name = fn_name
);
@ -431,7 +431,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
/// Like `in_db`, but gives access to methods for setting the
/// value of an input. Not applicable to derived queries.
///
/// # Threads, cancellation, and blocking
/// # Threads, cancelation, and blocking
///
/// Mutating the value of a query cannot be done while there are
/// still other queries executing. If you are using your database
@ -447,14 +447,14 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
/// deadlock.
///
/// Before blocking, the thread that is attempting to `set` will
/// also set a cancellation flag. This will cause any query
/// also set a cancelation flag. This will cause any query
/// invocations in other threads to unwind with a `Canceled`
/// sentinel value and eventually let the `set` succeed once all
/// threads have unwound past the salsa invocation.
///
/// If your query implementations are performing expensive
/// operations without invoking another query, you can also use
/// the `Runtime::unwind_if_cancelled` method to check for an
/// the `Runtime::unwind_if_canceled` method to check for an
/// ongoing cancelation and bring those operations to a close,
/// thus allowing the `set` to succeed. Otherwise, long-running
/// computations may lead to "starvation", meaning that the

View file

@ -274,8 +274,8 @@ pub trait ParallelDatabase: Database + Send {
/// series of queries in parallel and arranging the results. Using
/// this method for that purpose ensures that those queries will
/// see a consistent view of the database (it is also advisable
/// for those queries to use the [`Runtime::unwind_if_cancelled`]
/// method to check for cancellation).
/// for those queries to use the [`Runtime::unwind_if_canceled`]
/// method to check for cancelation).
///
/// # Panics
///
@ -539,7 +539,7 @@ where
/// an active query computation.
///
/// If you are using `snapshot`, see the notes on blocking
/// and cancellation on [the `query_mut` method].
/// and cancelation on [the `query_mut` method].
///
/// [the `query_mut` method]: trait.Database.html#method.query_mut
pub fn set(&mut self, key: Q::Key, value: Q::Value)
@ -554,7 +554,7 @@ where
/// outside of an active query computation.
///
/// If you are using `snapshot`, see the notes on blocking
/// and cancellation on [the `query_mut` method].
/// and cancelation on [the `query_mut` method].
///
/// [the `query_mut` method]: trait.Database.html#method.query_mut
pub fn set_with_durability(&mut self, key: Q::Key, value: Q::Value, durability: Durability)
@ -651,7 +651,7 @@ impl Canceled {
std::panic::resume_unwind(Box::new(Self));
}
/// Runs `f`, and catches any salsa cancellation.
/// Runs `f`, and catches any salsa cancelation.
pub fn catch<F, T>(f: F) -> Result<T, Canceled>
where
F: FnOnce() -> T + UnwindSafe,

View file

@ -119,7 +119,7 @@ impl Runtime {
/// Q and then (c) doing a sweep.
///
/// **WARNING:** Just like an ordinary write, this method triggers
/// cancellation. If you invoke it while a snapshot exists, it
/// cancelation. If you invoke it while a snapshot exists, it
/// will block until that snapshot is dropped -- if that snapshot
/// is owned by the current thread, this could trigger deadlock.
pub fn synthetic_write(&mut self, durability: Durability) {
@ -180,7 +180,7 @@ impl Runtime {
let current_revision = self.current_revision();
let pending_revision = self.pending_revision();
debug!(
"unwind_if_cancelled: current_revision={:?}, pending_revision={:?}",
"unwind_if_canceled: current_revision={:?}, pending_revision={:?}",
current_revision, pending_revision
);
if pending_revision > current_revision {
@ -740,7 +740,7 @@ impl RevisionGuard {
//
// This has the side-effect that we are responsible to ensure
// that people contending for the write lock do not starve,
// but this is what we achieve via the cancellation mechanism.
// but this is what we achieve via the cancelation mechanism.
//
// (In particular, since we only ever have one "mutating
// handle" to the database, the only contention for the global

View file

@ -13,11 +13,11 @@ macro_rules! assert_canceled {
};
}
/// Add test where a call to `sum` is cancelled by a simultaneous
/// Add test where a call to `sum` is canceled by a simultaneous
/// write. Check that we recompute the result in next revision, even
/// though none of the inputs have changed.
#[test]
fn in_par_get_set_cancellation_immediate() {
fn in_par_get_set_cancelation_immediate() {
let mut db = ParDatabaseImpl::default();
db.set_input('a', 100);
@ -28,11 +28,11 @@ fn in_par_get_set_cancellation_immediate() {
let thread1 = std::thread::spawn({
let db = db.snapshot();
move || {
// This will not return until it sees cancellation is
// This will not return until it sees cancelation is
// signaled.
db.knobs().sum_signal_on_entry.with_value(1, || {
db.knobs()
.sum_wait_for_cancellation
.sum_wait_for_cancelation
.with_value(CancelationFlag::Panic, || db.sum("abc"))
})
}
@ -41,7 +41,7 @@ fn in_par_get_set_cancellation_immediate() {
// Wait until we have entered `sum` in the other thread.
db.wait_for(1);
// Try to set the input. This will signal cancellation.
// Try to set the input. This will signal cancelation.
db.set_input('d', 1000);
// This should re-compute the value (even though no input has changed).
@ -55,10 +55,10 @@ fn in_par_get_set_cancellation_immediate() {
assert_eq!(thread2.join().unwrap(), 111);
}
/// Here, we check that `sum`'s cancellation is propagated
/// Here, we check that `sum`'s cancelation is propagated
/// to `sum2` properly.
#[test]
fn in_par_get_set_cancellation_transitive() {
fn in_par_get_set_cancelation_transitive() {
let mut db = ParDatabaseImpl::default();
db.set_input('a', 100);
@ -69,11 +69,11 @@ fn in_par_get_set_cancellation_transitive() {
let thread1 = std::thread::spawn({
let db = db.snapshot();
move || {
// This will not return until it sees cancellation is
// This will not return until it sees cancelation is
// signaled.
db.knobs().sum_signal_on_entry.with_value(1, || {
db.knobs()
.sum_wait_for_cancellation
.sum_wait_for_cancelation
.with_value(CancelationFlag::Panic, || db.sum2("abc"))
})
}
@ -82,7 +82,7 @@ fn in_par_get_set_cancellation_transitive() {
// Wait until we have entered `sum` in the other thread.
db.wait_for(1);
// Try to set the input. This will signal cancellation.
// Try to set the input. This will signal cancelation.
db.set_input('d', 1000);
// This should re-compute the value (even though no input has changed).
@ -98,7 +98,7 @@ fn in_par_get_set_cancellation_transitive() {
/// https://github.com/salsa-rs/salsa/issues/66
#[test]
fn no_back_dating_in_cancellation() {
fn no_back_dating_in_cancelation() {
let mut db = ParDatabaseImpl::default();
db.set_input('a', 1);
@ -106,10 +106,10 @@ fn no_back_dating_in_cancellation() {
let db = db.snapshot();
move || {
// Here we compute a long-chain of queries,
// but the last one gets cancelled.
// but the last one gets canceled.
db.knobs().sum_signal_on_entry.with_value(1, || {
db.knobs()
.sum_wait_for_cancellation
.sum_wait_for_cancelation
.with_value(CancelationFlag::Panic, || db.sum3("a"))
})
}
@ -120,7 +120,7 @@ fn no_back_dating_in_cancellation() {
// Set unrelated input to bump revision
db.set_input('b', 2);
// Here we should recompuet the whole chain again, clearing the cancellation
// Here we should recompuet the whole chain again, clearing the cancelation
// state. If we get `usize::max()` here, it is a bug!
assert_eq!(db.sum3("a"), 1);

View file

@ -6,11 +6,11 @@ use std::{
sync::Arc,
};
/// Add test where a call to `sum` is cancelled by a simultaneous
/// Add test where a call to `sum` is canceled by a simultaneous
/// write. Check that we recompute the result in next revision, even
/// though none of the inputs have changed.
#[test]
fn in_par_get_set_cancellation() {
fn in_par_get_set_cancelation() {
let mut db = ParDatabaseImpl::default();
db.set_input('a', 1);
@ -21,14 +21,14 @@ fn in_par_get_set_cancellation() {
let db = db.snapshot();
let signal = signal.clone();
move || {
// Check that cancellation flag is not yet set, because
// Check that cancelation flag is not yet set, because
// `set` cannot have been called yet.
catch_unwind(AssertUnwindSafe(|| db.salsa_runtime().unwind_if_canceled())).unwrap();
// Signal other thread to proceed.
signal.signal(1);
// Wait for other thread to signal cancellation
// Wait for other thread to signal cancelation
catch_unwind(AssertUnwindSafe(|| loop {
db.salsa_runtime().unwind_if_canceled();
std::thread::yield_now();
@ -50,7 +50,7 @@ fn in_par_get_set_cancellation() {
let thread2 = std::thread::spawn({
let signal = signal.clone();
move || {
// Wait until thread 1 has asserted that they are not cancelled
// Wait until thread 1 has asserted that they are not canceled
// before we invoke `set.`
signal.wait_for(1);

View file

@ -1,6 +1,6 @@
mod setup;
mod cancellation;
mod cancelation;
mod frozen;
mod independent;
mod race;

View file

@ -36,7 +36,7 @@ fn in_par_get_set_race() {
assert!(value1 == 111 || value1 == 1011, "illegal result {}", value1);
}
// thread2 can not observe a cancellation because it performs a
// thread2 can not observe a cancelation because it performs a
// database write before running any other queries.
assert_eq!(thread2.join().unwrap(), 1000);
}

View file

@ -90,9 +90,9 @@ pub(crate) struct KnobsStruct {
/// If true, invocations of `sum` will panic before they exit.
pub(crate) sum_should_panic: Cell<bool>,
/// If true, invocations of `sum` will wait for cancellation before
/// If true, invocations of `sum` will wait for cancelation before
/// they exit.
pub(crate) sum_wait_for_cancellation: Cell<CancelationFlag>,
pub(crate) sum_wait_for_cancelation: Cell<CancelationFlag>,
/// Invocations of `sum` will wait for this stage prior to exiting.
pub(crate) sum_wait_for_on_exit: Cell<usize>,
@ -119,10 +119,10 @@ fn sum(db: &dyn ParDatabase, key: &'static str) -> usize {
sum += db.input(ch);
}
match db.knobs().sum_wait_for_cancellation.get() {
match db.knobs().sum_wait_for_cancelation.get() {
CancelationFlag::Down => (),
CancelationFlag::Panic => {
log::debug!("waiting for cancellation");
log::debug!("waiting for cancelation");
loop {
db.salsa_runtime().unwind_if_canceled();
std::thread::yield_now();

View file

@ -56,7 +56,7 @@ enum MutatorOp {
WriteOp(WriteOp),
LaunchReader {
ops: Vec<ReadOp>,
check_cancellation: bool,
check_cancelation: bool,
},
}
@ -85,7 +85,7 @@ impl rand::distributions::Distribution<MutatorOp> for rand::distributions::Stand
} else {
MutatorOp::LaunchReader {
ops: (0..N_READER_OPS).map(|_| rng.gen()).collect(),
check_cancellation: rng.gen(),
check_cancelation: rng.gen(),
}
}
}
@ -118,9 +118,9 @@ impl rand::distributions::Distribution<ReadOp> for rand::distributions::Standard
}
}
fn db_reader_thread(db: &StressDatabaseImpl, ops: Vec<ReadOp>, check_cancellation: bool) {
fn db_reader_thread(db: &StressDatabaseImpl, ops: Vec<ReadOp>, check_cancelation: bool) {
for op in ops {
if check_cancellation {
if check_cancelation {
db.salsa_runtime().unwind_if_canceled();
}
op.execute(db);
@ -188,10 +188,10 @@ fn stress_test() {
MutatorOp::WriteOp(w) => w.execute(&mut db),
MutatorOp::LaunchReader {
ops,
check_cancellation,
check_cancelation,
} => all_threads.push(std::thread::spawn({
let db = db.snapshot();
move || Canceled::catch(|| db_reader_thread(&db, ops, check_cancellation))
move || Canceled::catch(|| db_reader_thread(&db, ops, check_cancelation))
})),
}
}