id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:5 | fn only_blocking_with_pending() {
only_blocking_inner(true)
}
}
mod group_b {
use super::*;
fn blocking_and_regular_inner(first_pending: bool) {
const NUM: usize = 3;
loom::model(move || {
let pool = mk_pool(1);
let cnt = Arc::new(AtomicUsize::new(0));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:6 | drop(pool);
});
}
#[test]
#[ignore] // TODO: uncomment
fn blocking_and_regular_without_pending() {
blocking_and_regular_inner(false);
}
#[test]
fn blocking_and_regular_with_pending() {
blocking_and_regular_inner(true);
}
#[test]
fn join_output() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:7 | Poll::Ready(())
})
.await;
});
})
}
#[test]
fn complete_block_on_under_load() {
loom::model(|| {
let pool = mk_pool(1);
pool.block_on(async {
// Trigger a re-schedule
crate::spawn(track(asyn... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:8 | let _ = done_rx.await;
});
let _ = rx.await;
let _ = done_tx.send(());
}));
});
}
}
mod group_c {
use super::*;
#[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(a... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:9 | let pool = runtime::Builder::new_multi_thread_alt()
.worker_threads(2)
// Set the intervals to avoid tuning logic
.global_queue_interval(61)
.local_queue_capacity(1)
.build()
.unwrap();
for _ in 0..NUM_SPAWNS {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:10 | .local_queue_capacity(DEPTH)
.build()
.unwrap();
// Use std types to avoid adding backtracking.
type Flag = std::sync::Arc<std::sync::atomic::AtomicIsize>;
let flag: Flag = Default::default();
let flag1 = flag.clone();
let (tx... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:11 | let (tx3, rx3) = oneshot::channel();
pool.spawn(async move {
loom::skip_branch();
tx3.send(());
});
pool.spawn(async {});
pool.spawn(async {});
loom::explore();
rx3.recv();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:12 | done_tx1.assert_send(());
}
}));
// Spawn a second task
pool.spawn(track(async move {
multi_gated().await;
if 1 == c2.fetch_add(1, Relaxed) {
done_tx2.assert_send(());
}
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:13 | thread::spawn(move || {
gate.store(true, SeqCst);
waker.wake_by_ref();
});
} else {
spawn(track(async move {
gate.store(true, SeqCst);
waker.wake_by_ref();
}));
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:14 | gate.waker.wake();
}
}));
}
poll_fn(move |cx| {
gate.waker.register_by_ref(cx.waker());
if gate.count.load(SeqCst) < 2 {
Poll::Pending
} else {
Poll::Ready(())
}
})
.await;
}
fn track<T: Future>(f: T) -> Track<T> {
Track {... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 521 | 570 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:15 | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let me = self.project();
Poll::Ready(Track {
inner: ready!(me.inner.poll(cx)),
arc: me.arc.clone(),
})
}
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 561 | 570 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:9 | let c1 = Arc::new(AtomicUsize::new(0));
let (done_tx, done_rx) = oneshot::channel();
let done_tx1 = AtomicOneshot::new(done_tx);
let done_tx2 = done_tx1.clone();
// Spawn a task
let c2 = c1.clone();
pool.spawn(track(async move {
m... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:10 | fn gated2(thread: bool) -> impl Future<Output = &'static str> {
use loom::thread;
use std::sync::Arc;
let gate = Arc::new(AtomicBool::new(false));
let mut fired = false;
poll_fn(move |cx| {
if !fired {
let gate = gate.clone();
let waker = cx.waker().clone();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:11 | count: AtomicUsize,
}
let gate = Arc::new(Gate {
waker: loom::future::AtomicWaker::new(),
count: AtomicUsize::new(0),
});
{
let gate = gate.clone();
spawn(track(async move {
for i in 1..3 {
gate.count.store(i, SeqCst);
gate.wa... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_multi_thread_alt.rs:12 | // Arc is used to hook into loom's leak tracking.
arc: Arc<()>,
}
}
impl<T> Track<T> {
fn into_inner(self) -> T {
self.inner
}
}
impl<T: Future> Future for Track<T> {
type Output = Track<T::Output>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_multi_thread_alt.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/tests/loom_multi_thread_alt.rs | 441 | 463 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_oneshot.rs:1 | use crate::loom::sync::{Arc, Mutex};
use loom::sync::Notify;
pub(crate) fn channel<T>() -> (Sender<T>, Receiver<T>) {
let inner = Arc::new(Inner {
notify: Notify::new(),
value: Mutex::new(None),
});
let tx = Sender {
inner: inner.clone(),
};
let rx = Receiver { inner };
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/tests/loom_oneshot.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:1 | /// Full runtime loom tests. These are heavy tests and take significant time to
/// run on CI.
///
/// Use `LOOM_MAX_PREEMPTIONS=1` to do a "quick" run as a smoke test.
///
/// In order to speed up the C
use crate::future::poll_fn;
use crate::runtime::tests::loom_oneshot as oneshot;
use crate::runtime::{self, Runtime};... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:2 | // safety: Only one thread will see the boolean change from false
// to true, so that thread is able to take the value.
match self.taken.fetch_or(true, SeqCst) {
false => unsafe { Some(std::ptr::read(self.inner.as_ptr())) },
true => None,
}
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:3 | // here's the case we want to exercise:
//
// a worker that still has tasks in its local queue gets sent to the blocking pool (due to
// block_in_place). the blocking pool is shut down, so drops the worker. the worker's
// shutdown method never gets run.
//
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:4 | spawn(track(async move {
if 1 == c2.fetch_add(1, Relaxed) {
tx2.assert_send(());
}
}));
}));
rx.recv();
});
}
fn only_blocking_inner(first_pending: bool) {
loom::model(move || {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:5 | mod group_b {
use super::*;
fn blocking_and_regular_inner(first_pending: bool) {
const NUM: usize = 3;
loom::model(move || {
let pool = mk_pool(1);
let cnt = Arc::new(AtomicUsize::new(0));
let (block_tx, block_rx) = oneshot::channel();
let (done_... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:6 | #[test]
fn blocking_and_regular() {
blocking_and_regular_inner(false);
}
#[test]
fn blocking_and_regular_with_pending() {
blocking_and_regular_inner(true);
}
#[test]
fn join_output() {
loom::model(|| {
let rt = mk_pool(1);
rt.block_on(async ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:7 | }
#[test]
fn complete_block_on_under_load() {
loom::model(|| {
let pool = mk_pool(1);
pool.block_on(async {
// Trigger a re-schedule
crate::spawn(track(async {
for _ in 0..2 {
task::yield_now().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | let _ = done_tx.send(());
}));
});
}
}
mod group_c {
use super::*;
#[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(async move {
gated2(true).await;
}));
pool.spawn(track(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:9 | let done_tx2 = done_tx1.clone();
// Spawn a task
let c2 = c1.clone();
pool.spawn(track(async move {
multi_gated().await;
if 1 == c1.fetch_add(1, Relaxed) {
done_tx1.assert_send(());
}
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:10 | let mut fired = false;
poll_fn(move |cx| {
if !fired {
let gate = gate.clone();
let waker = cx.waker().clone();
if thread {
thread::spawn(move || {
gate.store(true, SeqCst);
waker.wake_by_ref();
});... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:11 | count: AtomicUsize::new(0),
});
{
let gate = gate.clone();
spawn(track(async move {
for i in 1..3 {
gate.count.store(i, SeqCst);
gate.waker.wake();
}
}));
}
poll_fn(move |cx| {
if gate.count.load(SeqCst) < 2 {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 401 | 458 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:12 | impl<T> Track<T> {
fn into_inner(self) -> T {
self.inner
}
}
impl<T: Future> Future for Track<T> {
type Output = Track<T::Output>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let me = self.project();
Poll::Ready(Track {
inner: ready!... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_pool.rs | 441 | 458 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:9 | let done_tx2 = done_tx1.clone();
// Spawn a task
let c2 = c1.clone();
pool.spawn(track(async move {
multi_gated().await;
if 1 == c1.fetch_add(1, Relaxed) {
done_tx1.assert_send(());
}
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 98c8c38e9674cd584495046c793969625276e63d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98c8c38e9674cd584495046c793969625276e63d/tokio/src/runtime/tests/loom_pool.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:10 | poll_fn(move |cx| {
if !fired {
let gate = gate.clone();
let waker = cx.waker().clone();
if thread {
thread::spawn(move || {
gate.store(true, SeqCst);
waker.wake_by_ref();
});
} else {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 98c8c38e9674cd584495046c793969625276e63d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98c8c38e9674cd584495046c793969625276e63d/tokio/src/runtime/tests/loom_pool.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:11 | });
{
let gate = gate.clone();
spawn(track(async move {
for i in 1..3 {
gate.count.store(i, SeqCst);
gate.waker.wake();
}
}));
}
poll_fn(move |cx| {
if gate.count.load(SeqCst) < 2 {
gate.waker.register_by_r... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 98c8c38e9674cd584495046c793969625276e63d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98c8c38e9674cd584495046c793969625276e63d/tokio/src/runtime/tests/loom_pool.rs | 401 | 457 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:12 | fn into_inner(self) -> T {
self.inner
}
}
impl<T: Future> Future for Track<T> {
type Output = Track<T::Output>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let me = self.project();
Poll::Ready(Track {
inner: ready!(me.inner.poll(cx)),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 98c8c38e9674cd584495046c793969625276e63d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98c8c38e9674cd584495046c793969625276e63d/tokio/src/runtime/tests/loom_pool.rs | 441 | 457 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | let _ = done_tx.send(());
}));
});
}
}
mod group_c {
use super::*;
#[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(async move {
gated2(true).await;
}));
pool.spawn(track(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:9 | let done_tx2 = done_tx1.clone();
// Spawn a task
let c2 = c1.clone();
pool.spawn(track(async move {
gated().await;
gated().await;
if 1 == c1.fetch_add(1, Relaxed) {
done_tx1.assert_send(());
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/tests/loom_pool.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:10 | use loom::thread;
use std::sync::Arc;
let gate = Arc::new(AtomicBool::new(false));
let mut fired = false;
poll_fn(move |cx| {
if !fired {
let gate = gate.clone();
let waker = cx.waker().clone();
if thread {
thread::spawn(move || {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/tests/loom_pool.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:11 | }
}
pin_project! {
struct Track<T> {
#[pin]
inner: T,
// Arc is used to hook into loom's leak tracking.
arc: Arc<()>,
}
}
impl<T> Track<T> {
fn into_inner(self) -> T {
self.inner
}
}
impl<T: Future> Future for Track<T> {
type Output = Track<T::Output>;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/tests/loom_pool.rs | 401 | 430 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:5 | mod group_b {
use super::*;
fn blocking_and_regular_inner(first_pending: bool) {
const NUM: usize = 3;
loom::model(move || {
let pool = mk_pool(1);
let cnt = Arc::new(AtomicUsize::new(0));
let (block_tx, block_rx) = oneshot::channel();
let (done_... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d01bda86a4a45b5aef85633df19ab6d113bd1f45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d01bda86a4a45b5aef85633df19ab6d113bd1f45/tokio/src/runtime/tests/loom_pool.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:6 | #[test]
fn blocking_and_regular() {
blocking_and_regular_inner(false);
}
#[test]
fn blocking_and_regular_with_pending() {
blocking_and_regular_inner(true);
}
#[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(tra... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d01bda86a4a45b5aef85633df19ab6d113bd1f45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d01bda86a4a45b5aef85633df19ab6d113bd1f45/tokio/src/runtime/tests/loom_pool.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:7 | }
#[test]
fn poll_drop_handle_then_drop() {
loom::model(|| {
let rt = mk_pool(1);
rt.block_on(async move {
let mut t = crate::spawn(track(async { "hello" }));
poll_fn(|cx| {
let _ = Pin::new(&mut t).poll(cx);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d01bda86a4a45b5aef85633df19ab6d113bd1f45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d01bda86a4a45b5aef85633df19ab6d113bd1f45/tokio/src/runtime/tests/loom_pool.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | #[test]
fn shutdown_with_notification() {
use crate::sync::oneshot;
loom::model(|| {
let rt = mk_pool(2);
let (done_tx, done_rx) = oneshot::channel::<()>();
rt.spawn(track(async move {
let (tx, rx) = oneshot::channel::<()>();
cra... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d01bda86a4a45b5aef85633df19ab6d113bd1f45 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d01bda86a4a45b5aef85633df19ab6d113bd1f45/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:1 | /// Full runtime loom tests. These are heavy tests and take significant time to
/// run on CI.
///
/// Use `LOOM_MAX_PREEMPTIONS=1` to do a "quick" run as a smoke test.
///
/// In order to speed up the C
use crate::future::poll_fn;
use crate::runtime::tests::loom_oneshot as oneshot;
use crate::runtime::{self, Runtime};... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:2 | crate::task::block_in_place(|| {});
}));
pool.spawn(track(async {}));
drop(pool);
});
}
#[test]
fn pool_multi_spawn() {
loom::model(|| {
let pool = mk_pool(2);
let c1 = Arc::new(AtomicUsize::new(0));
let (tx, rx) = one... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:3 | fn only_blocking_inner(first_pending: bool) {
loom::model(move || {
let pool = mk_pool(1);
let (block_tx, block_rx) = oneshot::channel();
pool.spawn(track(async move {
crate::task::block_in_place(move || {
block_tx.send(());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:4 | let (done_tx, done_rx) = oneshot::channel();
let done_tx = Arc::new(Mutex::new(Some(done_tx)));
pool.spawn(track(async move {
crate::task::block_in_place(move || {
block_tx.send(());
});
if first_pending {
t... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:5 | #[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(async move {
gated2(true).await;
}));
pool.spawn(track(async move {
gated2(false).await;
}));
drop(pool);
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:6 | let _ = Pin::new(&mut t).poll(cx);
Poll::Ready(())
})
.await;
});
})
}
#[test]
fn complete_block_on_under_load() {
loom::model(|| {
let pool = mk_pool(1);
pool.block_on(async {
// Trigge... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:7 | crate::spawn(async move {
crate::task::spawn_blocking(move || {
let _ = tx.send(());
});
let _ = done_rx.await;
});
let _ = rx.await;
let _ = done_tx.send(());
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | }));
// Spawn a second task
pool.spawn(track(async move {
gated().await;
gated().await;
if 1 == c2.fetch_add(1, Relaxed) {
done_tx2.lock().unwrap().take().unwrap().send(());
}
}));
done... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:9 | if thread {
thread::spawn(move || {
gate.store(true, SeqCst);
waker.wake_by_ref();
});
} else {
spawn(track(async move {
gate.store(true, SeqCst);
waker.wake_by_ref();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/tests/loom_pool.rs | 321 | 379 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:7 | crate::spawn(async move {
crate::task::spawn_blocking(move || {
let _ = tx.send(());
});
let _ = done_rx.await;
});
let _ = rx.await;
let _ = done_tx.send(());
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/tests/loom_pool.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | }));
// Spawn a second task
pool.spawn(track(async move {
gated().await;
gated().await;
if 1 == c2.fetch_add(1, Relaxed) {
done_tx2.lock().unwrap().take().unwrap().send(());
}
}));
done... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:10 | }
impl<T> Track<T> {
fn into_inner(self) -> T {
self.inner
}
}
impl<T: Future> Future for Track<T> {
type Output = Track<T::Output>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let me = self.project();
Poll::Ready(Track {
inner: rea... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/tests/loom_pool.rs | 361 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:5 | #[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(async move {
gated2(true).await;
}));
pool.spawn(track(async move {
gated2(false).await;
}));
drop(pool);
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/src/runtime/tests/loom_pool.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:6 | let _ = Pin::new(&mut t).poll(cx);
Poll::Ready(())
})
.await;
});
})
}
#[test]
fn complete_block_on_under_load() {
loom::model(|| {
let mut pool = mk_pool(1);
pool.block_on(async {
// Tr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/src/runtime/tests/loom_pool.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:5 | #[test]
fn pool_shutdown() {
loom::model(|| {
let pool = mk_pool(2);
pool.spawn(track(async move {
gated2(true).await;
}));
pool.spawn(track(async move {
gated2(false).await;
}));
drop(pool);
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/runtime/tests/loom_pool.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:6 | let _ = Pin::new(&mut t).poll(cx);
Poll::Ready(())
})
.await;
});
})
}
#[test]
fn complete_block_on_under_load() {
loom::model(|| {
let mut pool = mk_pool(1);
pool.block_on(async {
// Tr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/tests/loom_pool.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:7 | let (mut tx, mut rx) = mpsc::channel::<()>(10);
crate::spawn(async move {
crate::task::spawn_blocking(move || {
let _ = tx.try_send(());
});
let _ = done_rx.await;
});
while let Some(_)... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/tests/loom_pool.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:8 | }
}));
// Spawn a second task
pool.spawn(track(async move {
gated().await;
gated().await;
if 1 == c2.fetch_add(1, Relaxed) {
done_tx2.lock().unwrap().take().unwrap().send(());
}
}));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/tests/loom_pool.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_pool.rs:9 | let waker = cx.waker().clone();
if thread {
thread::spawn(move || {
gate.store(true, SeqCst);
waker.wake_by_ref();
});
} else {
spawn(track(async move {
gate.store(true, SeqCst);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_pool.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/tests/loom_pool.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::{queue, Stats};
use crate::runtime::tests::NoopSchedule;
use loom::thread;
use std::cell::RefCell;
fn new_stats() -> Stats {
Stats::new(&crate::runtime::WorkerMetrics::new())
}
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | local.push_back_or_overflow(task, &inject, &mut stats);
}
if local.pop().is_some() {
n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut stats);
whi... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | while local.pop().is_some() {
n += 1;
}
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut stats);
if local.pop().is_some() {
n +... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut stats).is_none() {
return 0;
}
let mut n = 1;
while local.pop().is_some() {
n += 1;
}
n
}
loom::model(|| {
let (steal, mut local) = queue::local();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut stats = new_stats();
let (s1, mut l1) = queue::local();
let (s2, mut l2) = queue::local();
let inject = RefCell::new(vec![])... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/tests/loom_queue.rs | 161 | 205 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::{queue, Stats};
use crate::runtime::scheduler::Inject;
use crate::runtime::tests::NoopSchedule;
use loom::thread;
fn new_stats() -> Stats {
Stats::new(&crate::runtime::WorkerMetrics::new())
}
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = q... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | local.push_back_or_overflow(task, &inject, &mut stats);
}
if local.pop().is_some() {
n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut stats);
whi... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | }
while local.pop().is_some() {
n += 1;
}
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut stats);
if local.pop().is_some() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | const NUM_TASKS: usize = 5;
fn steal_tasks(steal: queue::Steal<NoopSchedule>) -> usize {
let mut stats = new_stats();
let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut stats).is_none() {
return 0;
}
let mut n = 1;
while local.po... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | n += 1;
}
while inject.pop().is_some() {
n += 1;
}
n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut stats = new_stats();
let (s1, mut l1) = que... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 161 | 212 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:6 | // Drain our tasks, then attempt to steal
while l1.pop().is_some() {}
s2.steal_into(&mut l1, &mut stats);
th.join().unwrap();
while l1.pop().is_some() {}
while l2.pop().is_some() {}
while inject.pop().is_some() {}
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/loom_queue.rs | 201 | 212 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::{queue, Stats};
use crate::runtime::task::Inject;
use crate::runtime::tests::NoopSchedule;
use loom::thread;
fn new_stats() -> Stats {
Stats::new(&crate::runtime::WorkerMetrics::new())
}
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue:... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::queue;
use crate::runtime::task::Inject;
use crate::runtime::tests::NoopSchedule;
use crate::runtime::MetricsBatch;
use loom::thread;
fn metrics_batch() -> MetricsBatch {
MetricsBatch::new(&crate::runtime::WorkerMetrics::new())
}
#[test]
fn basic() {
loom::model(|... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut metrics);
}
if local.pop().is_some() {
n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_b... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | n += 1;
}
while local.pop().is_some() {
n += 1;
}
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back_or_overflow(task, &inject, &mut metrics);
if lo... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | fn multi_stealer() {
const NUM_TASKS: usize = 5;
fn steal_tasks(steal: queue::Steal<NoopSchedule>) -> usize {
let mut metrics = metrics_batch();
let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut metrics).is_none() {
return 0;
}
let m... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | while local.pop().is_some() {
n += 1;
}
while inject.pop().is_some() {
n += 1;
}
n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut metrics =... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 161 | 213 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:6 | // Drain our tasks, then attempt to steal
while l1.pop().is_some() {}
s2.steal_into(&mut l1, &mut metrics);
th.join().unwrap();
while l1.pop().is_some() {}
while l2.pop().is_some() {}
while inject.pop().is_some() {}
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/loom_queue.rs | 201 | 213 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::queue;
use crate::runtime::task::Inject;
use crate::runtime::tests::NoopSchedule;
use crate::runtime::MetricsBatch;
use loom::thread;
fn metrics_batch() -> MetricsBatch {
MetricsBatch::new(&crate::runtime::WorkerMetrics::new())
}
#[test]
fn basic() {
loom::model(|... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
}
if local.pop().is_some() {
n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back(task, &i... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | n += 1;
}
while local.pop().is_some() {
n += 1;
}
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
if local.pop().is... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | fn multi_stealer() {
const NUM_TASKS: usize = 5;
fn steal_tasks(steal: queue::Steal<NoopSchedule>) -> usize {
let mut metrics = metrics_batch();
let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut metrics).is_none() {
return 0;
}
let m... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | while local.pop().is_some() {
n += 1;
}
while inject.pop().is_some() {
n += 1;
}
n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut metrics =... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/tests/loom_queue.rs | 161 | 213 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::scheduler::multi_thread::queue;
use crate::runtime::task::Inject;
use crate::runtime::tests::NoopSchedule;
use crate::runtime::MetricsBatch;
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | e14ca72e68fbfa04f12408ed916bf5f857dfa232 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | if local.pop().is_some() {
n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
while local.pop().is_some() {
n += 1;
}
}
while inj... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | e14ca72e68fbfa04f12408ed916bf5f857dfa232 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | n += 1;
}
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
if local.pop().is_some() {
n += 1;
}
for _ in 0..6 {
let ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | e14ca72e68fbfa04f12408ed916bf5f857dfa232 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | let mut metrics = MetricsBatch::new();
let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut metrics).is_none() {
return 0;
}
let mut n = 1;
while local.pop().is_some() {
n += 1;
}
n
}
loom::model(|| {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | e14ca72e68fbfa04f12408ed916bf5f857dfa232 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | while inject.pop().is_some() {
n += 1;
}
n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut metrics = MetricsBatch::new();
let (s1, mut l1) = queue::local();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | e14ca72e68fbfa04f12408ed916bf5f857dfa232 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/tests/loom_queue.rs | 161 | 209 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::blocking::NoopSchedule;
use crate::runtime::scheduler::multi_thread::queue;
use crate::runtime::task::Inject;
use crate::runtime::MetricsBatch;
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | a3411a412c3424df7dcd151441fe0435c0a92c9c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::blocking::NoopSchedule;
use crate::runtime::task::Inject;
use crate::runtime::thread_pool::queue;
use crate::runtime::MetricsBatch;
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
let mut metri... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 911a0efa87e36f0dffb13e3d52340d5c08415db1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::blocking::NoopSchedule;
use crate::runtime::task::Inject;
use crate::runtime::{queue, MetricsBatch};
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
let mut metrics = MetricsBatch::new();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
while local.pop().is_some() {
n += 1;
}
}
while inject.pop().is_some() {
n += 1;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | }
n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject, &mut metrics);
if local.pop().is_some() {
n += 1;
}
for _ in 0..6 {
let (task, _) = super::u... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | let (_, mut local) = queue::local();
if steal.steal_into(&mut local, &mut metrics).is_none() {
return 0;
}
let mut n = 1;
while local.pop().is_some() {
n += 1;
}
n
}
loom::model(|| {
let (steal, mut local) = queue::local();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | n += 1;
}
n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut metrics = MetricsBatch::new();
let (s1, mut l1) = queue::local();
let (s2, mut l2) = queue::local();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/tests/loom_queue.rs | 161 | 208 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::blocking::NoopSchedule;
use crate::runtime::queue;
use crate::runtime::stats::WorkerStatsBatcher;
use crate::runtime::task::Inject;
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
let th = thr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:2 | n += 1;
}
// Push another task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject);
while local.pop().is_some() {
n += 1;
}
}
while inject.pop().is_some() {
n += 1;
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/tests/loom_queue.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:3 | n
});
let mut n = 0;
// push a task, pop a task
let (task, _) = super::unowned(async {});
local.push_back(task, &inject);
if local.pop().is_some() {
n += 1;
}
for _ in 0..6 {
let (task, _) = super::unowned(async {});
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/tests/loom_queue.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:4 | if steal.steal_into(&mut local, &mut stats).is_none() {
return 0;
}
let mut n = 1;
while local.pop().is_some() {
n += 1;
}
n
}
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
// Pus... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/tests/loom_queue.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:5 | n += th1.join().unwrap();
n += th2.join().unwrap();
assert_eq!(n, NUM_TASKS);
});
}
#[test]
fn chained_steal() {
loom::model(|| {
let mut stats = WorkerStatsBatcher::new(0);
let (s1, mut l1) = queue::local();
let (s2, mut l2) = queue::local();
let inject = Injec... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/tests/loom_queue.rs | 161 | 206 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_queue.rs:1 | use crate::runtime::blocking::NoopSchedule;
use crate::runtime::queue;
use crate::runtime::task::Inject;
use loom::thread;
#[test]
fn basic() {
loom::model(|| {
let (steal, mut local) = queue::local();
let inject = Inject::new();
let th = thread::spawn(move || {
let (_, mut lo... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_queue.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/tests/loom_queue.rs | 1 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.