Skip to content

Commit 223f87b

Browse files
Canonicalize to US spelling of "cancelation"
1 parent 877d3f2 commit 223f87b

File tree

9 files changed

+46
-46
lines changed

9 files changed

+46
-46
lines changed

components/salsa-macros/src/query_group.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
282282
283283
See `{fn_name}` for details.
284284
285-
*Note:* Setting values will trigger cancellation
285+
*Note:* Setting values will trigger cancelation
286286
of any ongoing queries; this method blocks until
287-
those queries have been cancelled.
287+
those queries have been canceled.
288288
",
289289
fn_name = fn_name
290290
);
@@ -296,9 +296,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
296296
297297
See `{fn_name}` for details.
298298
299-
*Note:* Setting values will trigger cancellation
299+
*Note:* Setting values will trigger cancelation
300300
of any ongoing queries; this method blocks until
301-
those queries have been cancelled.
301+
those queries have been canceled.
302302
",
303303
fn_name = fn_name
304304
);
@@ -431,7 +431,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
431431
/// Like `in_db`, but gives access to methods for setting the
432432
/// value of an input. Not applicable to derived queries.
433433
///
434-
/// # Threads, cancellation, and blocking
434+
/// # Threads, cancelation, and blocking
435435
///
436436
/// Mutating the value of a query cannot be done while there are
437437
/// still other queries executing. If you are using your database
@@ -447,14 +447,14 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
447447
/// deadlock.
448448
///
449449
/// Before blocking, the thread that is attempting to `set` will
450-
/// also set a cancellation flag. This will cause any query
450+
/// also set a cancelation flag. This will cause any query
451451
/// invocations in other threads to unwind with a `Canceled`
452452
/// sentinel value and eventually let the `set` succeed once all
453453
/// threads have unwound past the salsa invocation.
454454
///
455455
/// If your query implementations are performing expensive
456456
/// operations without invoking another query, you can also use
457-
/// the `Runtime::unwind_if_cancelled` method to check for an
457+
/// the `Runtime::unwind_if_canceled` method to check for an
458458
/// ongoing cancelation and bring those operations to a close,
459459
/// thus allowing the `set` to succeed. Otherwise, long-running
460460
/// computations may lead to "starvation", meaning that the

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ pub trait ParallelDatabase: Database + Send {
274274
/// series of queries in parallel and arranging the results. Using
275275
/// this method for that purpose ensures that those queries will
276276
/// see a consistent view of the database (it is also advisable
277-
/// for those queries to use the [`Runtime::unwind_if_cancelled`]
278-
/// method to check for cancellation).
277+
/// for those queries to use the [`Runtime::unwind_if_canceled`]
278+
/// method to check for cancelation).
279279
///
280280
/// # Panics
281281
///
@@ -539,7 +539,7 @@ where
539539
/// an active query computation.
540540
///
541541
/// If you are using `snapshot`, see the notes on blocking
542-
/// and cancellation on [the `query_mut` method].
542+
/// and cancelation on [the `query_mut` method].
543543
///
544544
/// [the `query_mut` method]: trait.Database.html#method.query_mut
545545
pub fn set(&mut self, key: Q::Key, value: Q::Value)
@@ -554,7 +554,7 @@ where
554554
/// outside of an active query computation.
555555
///
556556
/// If you are using `snapshot`, see the notes on blocking
557-
/// and cancellation on [the `query_mut` method].
557+
/// and cancelation on [the `query_mut` method].
558558
///
559559
/// [the `query_mut` method]: trait.Database.html#method.query_mut
560560
pub fn set_with_durability(&mut self, key: Q::Key, value: Q::Value, durability: Durability)
@@ -651,7 +651,7 @@ impl Canceled {
651651
std::panic::resume_unwind(Box::new(Self));
652652
}
653653

654-
/// Runs `f`, and catches any salsa cancellation.
654+
/// Runs `f`, and catches any salsa cancelation.
655655
pub fn catch<F, T>(f: F) -> Result<T, Canceled>
656656
where
657657
F: FnOnce() -> T + UnwindSafe,

src/runtime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Runtime {
119119
/// Q and then (c) doing a sweep.
120120
///
121121
/// **WARNING:** Just like an ordinary write, this method triggers
122-
/// cancellation. If you invoke it while a snapshot exists, it
122+
/// cancelation. If you invoke it while a snapshot exists, it
123123
/// will block until that snapshot is dropped -- if that snapshot
124124
/// is owned by the current thread, this could trigger deadlock.
125125
pub fn synthetic_write(&mut self, durability: Durability) {
@@ -180,7 +180,7 @@ impl Runtime {
180180
let current_revision = self.current_revision();
181181
let pending_revision = self.pending_revision();
182182
debug!(
183-
"unwind_if_cancelled: current_revision={:?}, pending_revision={:?}",
183+
"unwind_if_canceled: current_revision={:?}, pending_revision={:?}",
184184
current_revision, pending_revision
185185
);
186186
if pending_revision > current_revision {
@@ -740,7 +740,7 @@ impl RevisionGuard {
740740
//
741741
// This has the side-effect that we are responsible to ensure
742742
// that people contending for the write lock do not starve,
743-
// but this is what we achieve via the cancellation mechanism.
743+
// but this is what we achieve via the cancelation mechanism.
744744
//
745745
// (In particular, since we only ever have one "mutating
746746
// handle" to the database, the only contention for the global

tests/parallel/cancellation.rs renamed to tests/parallel/cancelation.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ macro_rules! assert_canceled {
1313
};
1414
}
1515

16-
/// Add test where a call to `sum` is cancelled by a simultaneous
16+
/// Add test where a call to `sum` is canceled by a simultaneous
1717
/// write. Check that we recompute the result in next revision, even
1818
/// though none of the inputs have changed.
1919
#[test]
20-
fn in_par_get_set_cancellation_immediate() {
20+
fn in_par_get_set_cancelation_immediate() {
2121
let mut db = ParDatabaseImpl::default();
2222

2323
db.set_input('a', 100);
@@ -28,11 +28,11 @@ fn in_par_get_set_cancellation_immediate() {
2828
let thread1 = std::thread::spawn({
2929
let db = db.snapshot();
3030
move || {
31-
// This will not return until it sees cancellation is
31+
// This will not return until it sees cancelation is
3232
// signaled.
3333
db.knobs().sum_signal_on_entry.with_value(1, || {
3434
db.knobs()
35-
.sum_wait_for_cancellation
35+
.sum_wait_for_cancelation
3636
.with_value(CancelationFlag::Panic, || db.sum("abc"))
3737
})
3838
}
@@ -41,7 +41,7 @@ fn in_par_get_set_cancellation_immediate() {
4141
// Wait until we have entered `sum` in the other thread.
4242
db.wait_for(1);
4343

44-
// Try to set the input. This will signal cancellation.
44+
// Try to set the input. This will signal cancelation.
4545
db.set_input('d', 1000);
4646

4747
// This should re-compute the value (even though no input has changed).
@@ -55,10 +55,10 @@ fn in_par_get_set_cancellation_immediate() {
5555
assert_eq!(thread2.join().unwrap(), 111);
5656
}
5757

58-
/// Here, we check that `sum`'s cancellation is propagated
58+
/// Here, we check that `sum`'s cancelation is propagated
5959
/// to `sum2` properly.
6060
#[test]
61-
fn in_par_get_set_cancellation_transitive() {
61+
fn in_par_get_set_cancelation_transitive() {
6262
let mut db = ParDatabaseImpl::default();
6363

6464
db.set_input('a', 100);
@@ -69,11 +69,11 @@ fn in_par_get_set_cancellation_transitive() {
6969
let thread1 = std::thread::spawn({
7070
let db = db.snapshot();
7171
move || {
72-
// This will not return until it sees cancellation is
72+
// This will not return until it sees cancelation is
7373
// signaled.
7474
db.knobs().sum_signal_on_entry.with_value(1, || {
7575
db.knobs()
76-
.sum_wait_for_cancellation
76+
.sum_wait_for_cancelation
7777
.with_value(CancelationFlag::Panic, || db.sum2("abc"))
7878
})
7979
}
@@ -82,7 +82,7 @@ fn in_par_get_set_cancellation_transitive() {
8282
// Wait until we have entered `sum` in the other thread.
8383
db.wait_for(1);
8484

85-
// Try to set the input. This will signal cancellation.
85+
// Try to set the input. This will signal cancelation.
8686
db.set_input('d', 1000);
8787

8888
// This should re-compute the value (even though no input has changed).
@@ -98,18 +98,18 @@ fn in_par_get_set_cancellation_transitive() {
9898

9999
/// https://github.com/salsa-rs/salsa/issues/66
100100
#[test]
101-
fn no_back_dating_in_cancellation() {
101+
fn no_back_dating_in_cancelation() {
102102
let mut db = ParDatabaseImpl::default();
103103

104104
db.set_input('a', 1);
105105
let thread1 = std::thread::spawn({
106106
let db = db.snapshot();
107107
move || {
108108
// Here we compute a long-chain of queries,
109-
// but the last one gets cancelled.
109+
// but the last one gets canceled.
110110
db.knobs().sum_signal_on_entry.with_value(1, || {
111111
db.knobs()
112-
.sum_wait_for_cancellation
112+
.sum_wait_for_cancelation
113113
.with_value(CancelationFlag::Panic, || db.sum3("a"))
114114
})
115115
}
@@ -120,7 +120,7 @@ fn no_back_dating_in_cancellation() {
120120
// Set unrelated input to bump revision
121121
db.set_input('b', 2);
122122

123-
// Here we should recompuet the whole chain again, clearing the cancellation
123+
// Here we should recompuet the whole chain again, clearing the cancelation
124124
// state. If we get `usize::max()` here, it is a bug!
125125
assert_eq!(db.sum3("a"), 1);
126126

tests/parallel/frozen.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use std::{
66
sync::Arc,
77
};
88

9-
/// Add test where a call to `sum` is cancelled by a simultaneous
9+
/// Add test where a call to `sum` is canceled by a simultaneous
1010
/// write. Check that we recompute the result in next revision, even
1111
/// though none of the inputs have changed.
1212
#[test]
13-
fn in_par_get_set_cancellation() {
13+
fn in_par_get_set_cancelation() {
1414
let mut db = ParDatabaseImpl::default();
1515

1616
db.set_input('a', 1);
@@ -21,14 +21,14 @@ fn in_par_get_set_cancellation() {
2121
let db = db.snapshot();
2222
let signal = signal.clone();
2323
move || {
24-
// Check that cancellation flag is not yet set, because
24+
// Check that cancelation flag is not yet set, because
2525
// `set` cannot have been called yet.
2626
catch_unwind(AssertUnwindSafe(|| db.salsa_runtime().unwind_if_canceled())).unwrap();
2727

2828
// Signal other thread to proceed.
2929
signal.signal(1);
3030

31-
// Wait for other thread to signal cancellation
31+
// Wait for other thread to signal cancelation
3232
catch_unwind(AssertUnwindSafe(|| loop {
3333
db.salsa_runtime().unwind_if_canceled();
3434
std::thread::yield_now();
@@ -50,7 +50,7 @@ fn in_par_get_set_cancellation() {
5050
let thread2 = std::thread::spawn({
5151
let signal = signal.clone();
5252
move || {
53-
// Wait until thread 1 has asserted that they are not cancelled
53+
// Wait until thread 1 has asserted that they are not canceled
5454
// before we invoke `set.`
5555
signal.wait_for(1);
5656

tests/parallel/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
mod setup;
22

3-
mod cancellation;
3+
mod cancelation;
44
mod frozen;
55
mod independent;
66
mod race;

tests/parallel/race.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn in_par_get_set_race() {
3636
assert!(value1 == 111 || value1 == 1011, "illegal result {}", value1);
3737
}
3838

39-
// thread2 can not observe a cancellation because it performs a
39+
// thread2 can not observe a cancelation because it performs a
4040
// database write before running any other queries.
4141
assert_eq!(thread2.join().unwrap(), 1000);
4242
}

tests/parallel/setup.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ pub(crate) struct KnobsStruct {
9090
/// If true, invocations of `sum` will panic before they exit.
9191
pub(crate) sum_should_panic: Cell<bool>,
9292

93-
/// If true, invocations of `sum` will wait for cancellation before
93+
/// If true, invocations of `sum` will wait for cancelation before
9494
/// they exit.
95-
pub(crate) sum_wait_for_cancellation: Cell<CancelationFlag>,
95+
pub(crate) sum_wait_for_cancelation: Cell<CancelationFlag>,
9696

9797
/// Invocations of `sum` will wait for this stage prior to exiting.
9898
pub(crate) sum_wait_for_on_exit: Cell<usize>,
@@ -119,10 +119,10 @@ fn sum(db: &dyn ParDatabase, key: &'static str) -> usize {
119119
sum += db.input(ch);
120120
}
121121

122-
match db.knobs().sum_wait_for_cancellation.get() {
122+
match db.knobs().sum_wait_for_cancelation.get() {
123123
CancelationFlag::Down => (),
124124
CancelationFlag::Panic => {
125-
log::debug!("waiting for cancellation");
125+
log::debug!("waiting for cancelation");
126126
loop {
127127
db.salsa_runtime().unwind_if_canceled();
128128
std::thread::yield_now();

tests/parallel/stress.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ enum MutatorOp {
5656
WriteOp(WriteOp),
5757
LaunchReader {
5858
ops: Vec<ReadOp>,
59-
check_cancellation: bool,
59+
check_cancelation: bool,
6060
},
6161
}
6262

@@ -85,7 +85,7 @@ impl rand::distributions::Distribution<MutatorOp> for rand::distributions::Stand
8585
} else {
8686
MutatorOp::LaunchReader {
8787
ops: (0..N_READER_OPS).map(|_| rng.gen()).collect(),
88-
check_cancellation: rng.gen(),
88+
check_cancelation: rng.gen(),
8989
}
9090
}
9191
}
@@ -118,9 +118,9 @@ impl rand::distributions::Distribution<ReadOp> for rand::distributions::Standard
118118
}
119119
}
120120

121-
fn db_reader_thread(db: &StressDatabaseImpl, ops: Vec<ReadOp>, check_cancellation: bool) {
121+
fn db_reader_thread(db: &StressDatabaseImpl, ops: Vec<ReadOp>, check_cancelation: bool) {
122122
for op in ops {
123-
if check_cancellation {
123+
if check_cancelation {
124124
db.salsa_runtime().unwind_if_canceled();
125125
}
126126
op.execute(db);
@@ -188,10 +188,10 @@ fn stress_test() {
188188
MutatorOp::WriteOp(w) => w.execute(&mut db),
189189
MutatorOp::LaunchReader {
190190
ops,
191-
check_cancellation,
191+
check_cancelation,
192192
} => all_threads.push(std::thread::spawn({
193193
let db = db.snapshot();
194-
move || Canceled::catch(|| db_reader_thread(&db, ops, check_cancellation))
194+
move || Canceled::catch(|| db_reader_thread(&db, ops, check_cancelation))
195195
})),
196196
}
197197
}

0 commit comments

Comments
 (0)