mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-12 08:30:51 +00:00
Merge pull request #637 from Veykril/veykril/push-pqxwpkxprotm
Fix parallel_map::execute_cancellation test
This commit is contained in:
commit
88a1d7774d
2 changed files with 3 additions and 6 deletions
|
@ -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!")
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue