Skip to content

Commit 249b2a1

Browse files
committed
switch to PCT shuttle scheduler
1 parent ff21328 commit 249b2a1

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ jobs:
5959
run: cargo test --workspace --doc
6060
- name: Check (without default features)
6161
run: cargo check --workspace --no-default-features
62-
- name: Check (loom)
63-
run: RUSTFLAGS="--cfg loom" cargo check --workspace --features loom
6462

6563
miri:
6664
name: Miri

tests/parallel/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) mod sync {
3131

3232
pub fn check(f: impl Fn() + Send + Sync + 'static) {
3333
let _serialize = SERIALIZE.lock();
34-
shuttle::check_random(f, 500);
34+
shuttle::check_pct(f, 1000, 50);
3535
}
3636
}
3737

tests/parallel/setup.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(dead_code)]
2+
13
use salsa::{Database, Storage};
24

35
use super::signal::Signal;

tests/parallel/signal.rs

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unused)]
2+
13
use super::sync::{Condvar, Mutex};
24

35
#[derive(Default)]
@@ -8,28 +10,36 @@ pub(crate) struct Signal {
810

911
impl Signal {
1012
pub(crate) fn signal(&self, stage: usize) {
11-
// This check avoids acquiring the lock for things that will
12-
// clearly be a no-op. Not *necessary* but helps to ensure we
13-
// are more likely to encounter weird race conditions;
14-
// otherwise calls to `sum` will tend to be unnecessarily
15-
// synchronous.
16-
if stage > 0 {
17-
let mut v = self.value.lock().unwrap();
18-
if stage > *v {
19-
*v = stage;
20-
self.cond_var.notify_all();
13+
// When running with shuttle we want to explore all possible
14+
// executions, so we avoid signals entirely.
15+
#[cfg(not(feature = "shuttle"))]
16+
{
17+
// This check avoids acquiring the lock for things that will
18+
// clearly be a no-op. Not *necessary* but helps to ensure we
19+
// are more likely to encounter weird race conditions;
20+
// otherwise calls to `sum` will tend to be unnecessarily
21+
// synchronous.
22+
if stage > 0 {
23+
let mut v = self.value.lock().unwrap();
24+
if stage > *v {
25+
*v = stage;
26+
self.cond_var.notify_all();
27+
}
2128
}
2229
}
2330
}
2431

2532
/// Waits until the given condition is true; the fn is invoked
2633
/// with the current stage.
2734
pub(crate) fn wait_for(&self, stage: usize) {
28-
// As above, avoid lock if clearly a no-op.
29-
if stage > 0 {
30-
let mut v = self.value.lock().unwrap();
31-
while *v < stage {
32-
v = self.cond_var.wait(v).unwrap();
35+
#[cfg(not(feature = "shuttle"))]
36+
{
37+
// As above, avoid lock if clearly a no-op.
38+
if stage > 0 {
39+
let mut v = self.value.lock().unwrap();
40+
while *v < stage {
41+
v = self.cond_var.wait(v).unwrap();
42+
}
3343
}
3444
}
3545
}

0 commit comments

Comments
 (0)