Merge pull request #637 from Veykril/veykril/push-pqxwpkxprotm
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled

Fix parallel_map::execute_cancellation test
This commit is contained in:
David Barsky 2024-12-23 16:15:20 +00:00 committed by GitHub
commit 88a1d7774d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View file

@ -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
field + dummy(db)
})
}
#[salsa::tracked]
fn dummy(_db: &dyn KnobsDatabase, _input: ParallelInput) -> ParallelInput {
fn dummy(_db: &dyn KnobsDatabase) -> u32 {
panic!("should never get here!")
}

View file

@ -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;
@ -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();