-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement thread park(), unpark(), and panicking() #75
Comments
The only thing we actually care about here is `hint::spin_loop`, which we just treat the same way as `yield_now`. Part of awslabs#75.
#77 will add park/unpark, and #78 will add diff --git a/src/queue.rs b/src/queue.rs
index e9b677d..cfcbb42 100644
--- a/src/queue.rs
+++ b/src/queue.rs
@@ -1,8 +1,8 @@
#[cfg(shuttle)]
-use shuttle::{sync, thread};
-use std::{cell::UnsafeCell, hint, mem};
+use shuttle::{sync, hint, thread};
+use std::{cell::UnsafeCell, mem};
#[cfg(not(shuttle))]
-use std::{sync, thread};
+use std::{sync, hint, thread};
use self::sync::atomic::{AtomicUsize, Ordering};
@@ -194,7 +194,7 @@ impl<T> Drop for Queue<T> {
#[cfg(shuttle)]
#[test]
fn shuttle() {
- shuttle::check_random(test_barrage, 10000);
+ shuttle::check_pct(test_barrage, 3, 10000);
}
#[test]
@@ -219,7 +219,7 @@ fn test_smoke() {
#[cfg_attr(not(shuttle), test)]
fn test_barrage() {
const NUM_THREADS: usize = if cfg!(miri) { 2 } else { 8 };
- const NUM_ELEMENTS: usize = if cfg!(miri) { 1 << 7 } else { 1 << 16 };
+ const NUM_ELEMENTS: usize = if cfg!(miri) || cfg!(shuttle) { 1 << 7 } else { 1 << 16 };
let sq = sync::Arc::new(Queue::new(NUM_ELEMENTS));
let mut handles = Vec::new();
Note that I switched the test from The #[cfg(shuttle)]
#[test]
fn shuttle() {
let scheduler = PctScheduler::new(3, 10000);
let runner = Runner::new(
scheduler,
shuttle::Config {
max_steps: shuttle::MaxSteps::FailAfter(100_000_000),
..Default::default()
},
);
runner.run(test_barrage);
}
|
The only thing we actually care about here is `hint::spin_loop`, which we just treat the same way as `yield_now`. Part of awslabs#75.
Already a TODO in code:
shuttle/src/thread.rs
Line 173 in 4a00174
This would help making
shuttle::thread
to be an in-place substitute tostd::thread
.The text was updated successfully, but these errors were encountered: