Skip to content

Commit

Permalink
Fix parallel_map::execute_cancellation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Dec 23, 2024
1 parent c8d47cc commit a7fb825
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/parallel/parallel_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ struct ParallelInput {
fn tracked_fn(db: &dyn salsa::Database, input: ParallelInput) -> Vec<u32> {
salsa::par_map(db, input.field(db), |_db, field| field + 1)
}

#[salsa::tracked]
fn a1(db: &dyn KnobsDatabase, input: ParallelInput) -> Vec<u32> {
db.signal(1);
salsa::par_map(db, input.field(db), |db, field| {
db.wait_for(2);
field + 1
dummy(db)
})
}

#[salsa::tracked]
fn dummy(_db: &dyn KnobsDatabase, _input: ParallelInput) -> ParallelInput {
fn dummy(_db: &dyn KnobsDatabase) -> u32 {
panic!("should never get here!")
}

Expand Down
4 changes: 0 additions & 4 deletions tests/parallel/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub(crate) struct Signal {

impl Signal {
pub(crate) fn signal(&self, stage: usize) {
dbg!(format!("signal({})", stage));

// This check avoids acquiring the lock for things that will
// clearly be a no-op. Not *necessary* but helps to ensure we
// are more likely to encounter weird race conditions;
Expand All @@ -27,8 +25,6 @@ impl Signal {
/// Waits until the given condition is true; the fn is invoked
/// with the current stage.
pub(crate) fn wait_for(&self, stage: usize) {
dbg!(format!("wait_for({})", stage));

// As above, avoid lock if clearly a no-op.
if stage > 0 {
let mut v = self.value.lock();
Expand Down

0 comments on commit a7fb825

Please sign in to comment.