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/sync/tests/atomic_waker.rs:2 | fn atomic_waker_panic_safe() {
use std::panic;
use std::ptr;
use std::task::{RawWaker, RawWakerVTable, Waker};
static PANICKING_VTABLE: RawWakerVTable = RawWakerVTable::new(
|_| panic!("clone"),
|_| unimplemented!("wake"),
|_| unimplemented!("wake_by_ref"),
|_| (),
)... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/sync/tests/atomic_waker.rs | 41 | 77 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Sync {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindg... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | 5b46395a1e165bc36ab0b798b958ef3d9b7aa060 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5b46395a1e165bc36ab0b798b958ef3d9b7aa060/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Send {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindg... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Send {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | 0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Send {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Send {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bi... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/atomic_waker.rs:1 | use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
trait AssertSend: Send {}
trait AssertSync: Send {}
impl AssertSend for AtomicWaker {}
impl AssertSync for AtomicWaker {}
impl AssertSend for Waker {}
impl AssertSync for Waker {}
#[test]
fn basic_usage() {
let mut waker = task::spawn(At... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/atomic_waker.rs | MIT | 09b770c5db31a1f35631600e1d239679354da2dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/09b770c5db31a1f35631600e1d239679354da2dd/tokio/src/sync/tests/atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_atomic_waker.rs:1 | use crate::sync::task::AtomicWaker;
use loom::future::block_on;
use loom::sync::atomic::AtomicUsize;
use loom::thread;
use std::future::poll_fn;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Arc;
use std::task::Poll::{Pending, Ready};
struct Chan {
num: AtomicUsize,
task: AtomicWaker,
}
#[test]
fn... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_atomic_waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_atomic_waker.rs:2 | Pending
}));
});
}
#[test]
fn test_panicky_waker() {
use std::panic;
use std::ptr;
use std::task::{RawWaker, RawWakerVTable, Waker};
static PANICKING_VTABLE: RawWakerVTable =
RawWakerVTable::new(|_| panic!("clone"), |_| (), |_| (), |_| ());
let panicking = unsafe { Waker::from... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_atomic_waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_atomic_waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_atomic_waker.rs:3 | // Note: this panic should have no effect on the overall state of the
// waker and it should proceed as normal.
//
// A thread above might race to flag a wakeup, and a WAKING state will
// be preserved if this expected panic races with that so the below
// procedure should be all... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_atomic_waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_atomic_waker.rs | 81 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_atomic_waker.rs:1 | use crate::sync::task::AtomicWaker;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::sync::atomic::AtomicUsize;
use loom::thread;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Arc;
use std::task::Poll::{Pending, Ready};
struct Chan {
num: AtomicUsize,
task: AtomicWaker,
}
#[test... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_atomic_waker.rs | MIT | 09b770c5db31a1f35631600e1d239679354da2dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/09b770c5db31a1f35631600e1d239679354da2dd/tokio/src/sync/tests/loom_atomic_waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_atomic_waker.rs:1 | use crate::sync::task::AtomicWaker;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::sync::atomic::AtomicUsize;
use loom::thread;
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Arc;
use std::task::Poll::{Pending, Ready};
struct Chan {
num: AtomicUsize,
task: AtomicWaker,
}
#[test... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_atomic_waker.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/sync/tests/loom_atomic_waker.rs | 1 | 45 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:1 | use crate::sync::broadcast;
use crate::sync::broadcast::error::RecvError::{Closed, Lagged};
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use tokio_test::{assert_err, assert_ok};
#[test]
fn broadcast_send() {
loom::model(|| {
let (tx1, mut rx) = broadcast::channel(2);
let tx1 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_broadcast.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:2 | assert_eq!(num, 6);
});
assert_ok!(th1.join());
assert_ok!(th2.join());
});
}
// An `Arc` is used as the value in order to detect memory leaks.
#[test]
fn broadcast_two() {
loom::model(|| {
let (tx, mut rx1) = broadcast::channel::<Arc<&'static str>>(16);
let mut rx2 = t... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_broadcast.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:3 | _ => panic!(),
}
});
});
assert_ok!(tx.send(Arc::new("hello")));
assert_ok!(tx.send(Arc::new("world")));
drop(tx);
assert_ok!(th1.join());
assert_ok!(th2.join());
});
}
#[test]
fn broadcast_wrap() {
loom::model(|| {
let (tx, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_broadcast.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:4 | loop {
match rx2.recv().await {
Ok(_) => num += 1,
Err(Closed) => break,
Err(Lagged(n)) => num += n as usize,
}
}
assert_eq!(num, 3);
});
});
asse... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_broadcast.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:5 | match assert_err!(rx1.recv().await) {
Closed => {}
_ => panic!(),
}
});
});
let th2 = thread::spawn(move || {
drop(rx2);
});
assert_ok!(tx.send("one"));
assert_ok!(tx.send("two"));
assert_ok... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_broadcast.rs | 161 | 207 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:5 | match assert_err!(rx1.recv().await) {
Closed => {}
_ => panic!(),
}
});
});
let th2 = thread::spawn(move || {
drop(rx2);
});
assert_ok!(tx.send("one"));
assert_ok!(tx.send("two"));
assert_ok... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | 8bfb1c92ceadd04f847d98ed482e7e59a3074954 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8bfb1c92ceadd04f847d98ed482e7e59a3074954/tokio/src/sync/tests/loom_broadcast.rs | 161 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:2 | assert_eq!(num, 6);
});
assert_ok!(th1.join());
assert_ok!(th2.join());
});
}
// An `Arc` is used as the value in order to detect memory leaks.
#[test]
fn broadcast_two() {
loom::model(|| {
let (tx, mut rx1) = broadcast::channel::<Arc<&'static str>>(16);
let mut rx2 = t... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | fb28caa90c8ab4453b259424c88dc7ec8ff06bbb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb28caa90c8ab4453b259424c88dc7ec8ff06bbb/tokio/src/sync/tests/loom_broadcast.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:3 | _ => panic!(),
}
});
});
assert_ok!(tx.send(Arc::new("hello")));
assert_ok!(tx.send(Arc::new("world")));
drop(tx);
assert_ok!(th1.join());
assert_ok!(th2.join());
});
}
// Exercise the Receiver Clone impl as well
#[test]
fn broadcast_wra... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | fb28caa90c8ab4453b259424c88dc7ec8ff06bbb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb28caa90c8ab4453b259424c88dc7ec8ff06bbb/tokio/src/sync/tests/loom_broadcast.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:4 | loop {
match rx2.recv().await {
Ok(_) => num += 1,
Err(Closed) => break,
Err(Lagged(n)) => num += n as usize,
}
}
assert_eq!(num, 3);
});
});
asse... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | fb28caa90c8ab4453b259424c88dc7ec8ff06bbb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb28caa90c8ab4453b259424c88dc7ec8ff06bbb/tokio/src/sync/tests/loom_broadcast.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:1 | use crate::sync::broadcast;
use crate::sync::broadcast::RecvError::{Closed, Lagged};
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use tokio_test::{assert_err, assert_ok};
#[test]
fn broadcast_send() {
loom::model(|| {
let (tx1, mut rx) = broadcast::channel(2);
let tx1 = Arc::... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | f9ea576ccae5beffeaa2f2c48c2c0d2f9449673b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ea576ccae5beffeaa2f2c48c2c0d2f9449673b/tokio/src/sync/tests/loom_broadcast.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:1 | use crate::sync::broadcast;
use crate::sync::broadcast::RecvError::{Closed, Lagged};
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use tokio_test::{assert_err, assert_ok};
// An `Arc` is used as the value in order to detect memory leaks.
#[test]
fn broadcast_two() {
loom::model(|| {
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/tests/loom_broadcast.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:2 | _ => panic!(),
}
});
});
assert_ok!(tx.send(Arc::new("hello")));
assert_ok!(tx.send(Arc::new("world")));
drop(tx);
assert_ok!(th1.join());
assert_ok!(th2.join());
});
}
#[test]
fn broadcast_wrap() {
loom::model(|| {
let (tx, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/tests/loom_broadcast.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:3 | let mut num = 0;
loop {
match rx2.recv().await {
Ok(_) => num += 1,
Err(Closed) => break,
Err(Lagged(n)) => {
num += n as usize
}
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/tests/loom_broadcast.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_broadcast.rs:4 | let v = assert_ok!(rx1.recv().await);
assert_eq!(v, "three");
match assert_err!(rx1.recv().await) {
Closed => {}
_ => panic!(),
}
});
});
let th2 = thread::spawn(move || {
drop(rx2);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/tests/loom_broadcast.rs | 121 | 144 |
tokio-rs/tokio:tokio/src/sync/tests/loom_cancellation_token.rs:2 | let th2 = thread::spawn(move || {
token2.cancel();
});
let th3 = thread::spawn(move || {
block_on(async {
child_token.cancelled().await;
});
});
assert_ok!(th1.join());
assert_ok!(th2.join());
assert_ok!(th3.join());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/tests/loom_cancellation_token.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_cancellation_token.rs:3 | #[test]
fn drop_token_with_childs() {
loom::model(|| {
let token1 = CancellationToken::new();
let child_token1 = token1.child_token();
let child_token2 = token1.child_token();
let th1 = thread::spawn(move || {
drop(token1);
});
let th2 = thread::spawn(mo... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/tests/loom_cancellation_token.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_cancellation_token.rs:1 | use crate::scope::CancellationToken;
use loom::{future::block_on, thread};
use tokio_test::assert_ok;
#[test]
fn cancel_token() {
loom::model(|| {
let token = CancellationToken::new();
let token1 = token.clone();
let th1 = thread::spawn(move || {
block_on(async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/tests/loom_cancellation_token.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_list.rs:1 | use crate::sync::mpsc::list;
use loom::thread;
use std::sync::Arc;
#[test]
fn smoke() {
use crate::sync::mpsc::block::Read;
const NUM_TX: usize = 2;
const NUM_MSG: usize = 2;
loom::model(|| {
let (tx, mut rx) = list::channel();
let tx = Arc::new(tx);
for th in 0..NUM_TX {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_list.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/sync/tests/loom_list.rs:1 | use crate::sync::mpsc::list;
use loom::thread;
use std::sync::Arc;
#[test]
fn smoke() {
use crate::sync::mpsc::block::Read::*;
const NUM_TX: usize = 2;
const NUM_MSG: usize = 2;
loom::model(|| {
let (tx, mut rx) = list::channel();
let tx = Arc::new(tx);
for th in 0..NUM_TX {... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_list.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/sync/tests/loom_list.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc::{self, BLOCK_CAP};
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use std::future::poll_fn;
use tokio_test::assert_ok;
#[test]
fn closing_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).un... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:2 | assert!(v.is_none());
});
}
#[test]
fn closing_bounded_rx() {
loom::model(|| {
let (tx1, rx) = mpsc::channel::<()>(16);
let tx2 = tx1.clone();
thread::spawn(move || {
drop(rx);
});
block_on(tx1.closed());
block_on(tx2.closed());
});
}
#[test]
fn... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:3 | assert_ok!(th2.join());
assert_ok!(th3.join());
});
}
#[test]
fn closing_unbounded_rx() {
loom::model(|| {
let (tx1, rx) = mpsc::unbounded_channel::<()>();
let tx2 = tx1.clone();
thread::spawn(move || {
drop(rx);
});
block_on(tx1.closed());
b... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:4 | let (tx, mut rx) = mpsc::unbounded_channel::<()>();
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
drop(tx);
});
}
drop(tx);
let v = block_on(rx.recv());
assert!(v.is_none());
});
}
#[test]
fn try_recv() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:5 | let (tx, rx) = mpsc::channel(PERMITS);
let sem = Arc::new(Semaphore::new(PERMITS));
let ctx = Arc::new(Context {
sem,
tx,
rx: Mutex::new(rx),
});
for _ in 0..PERMITS {
assert_ok!(ctx.tx.clone().try_send(()));
}
let mut thr... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:6 | block_on(send.send("message1")).unwrap();
assert!(recv.len() != 0);
join.join().unwrap();
});
}
#[test]
fn nonempty_after_send() {
loom::model(|| {
let (send, recv) = mpsc::channel(10);
let send2 = send.clone();
let join = thread::spawn(move || {
block_on(s... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:7 | fn len_during_close_helper(n: usize) {
loom::model(move || {
let (tx, rx) = mpsc::channel::<()>(n + 1);
for _ in 0..n {
tx.try_send(()).unwrap();
}
let th1 = thread::spawn(move || {
assert_eq!(rx.len(), n);
});
drop(tx);
th1.join().... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_mpsc.rs | 241 | 277 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:4 | let (tx, mut rx) = mpsc::unbounded_channel::<()>();
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
drop(tx);
});
}
drop(tx);
let v = block_on(rx.recv());
assert!(v.is_none());
});
}
#[test]
fn try_recv() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/tests/loom_mpsc.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:5 | let (tx, rx) = mpsc::channel(PERMITS);
let sem = Arc::new(Semaphore::new(PERMITS));
let ctx = Arc::new(Context {
sem,
tx,
rx: Mutex::new(rx),
});
for _ in 0..PERMITS {
assert_ok!(ctx.tx.clone().try_send(()));
}
let mut ths... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/tests/loom_mpsc.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use std::future::poll_fn;
use tokio_test::assert_ok;
#[test]
fn closing_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | a708ad19cb9ae652d8a813554e68cb1d86593eb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a708ad19cb9ae652d8a813554e68cb1d86593eb9/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:6 | block_on(send.send("message1")).unwrap();
assert!(recv.len() != 0);
join.join().unwrap();
});
}
#[test]
fn nonempty_after_send() {
loom::model(|| {
let (send, recv) = mpsc::channel(10);
let send2 = send.clone();
let join = thread::spawn(move || {
block_on(s... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | a708ad19cb9ae652d8a813554e68cb1d86593eb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a708ad19cb9ae652d8a813554e68cb1d86593eb9/tokio/src/sync/tests/loom_mpsc.rs | 201 | 224 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use tokio_test::assert_ok;
#[test]
fn closing_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:5 | let (tx, rx) = mpsc::channel(PERMITS);
let sem = Arc::new(Semaphore::new(PERMITS));
let ctx = Arc::new(Context {
sem,
tx,
rx: Mutex::new(rx),
});
for _ in 0..PERMITS {
assert_ok!(ctx.tx.clone().try_send(()));
}
let mut ths... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/tests/loom_mpsc.rs | 161 | 190 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:3 | assert_ok!(th2.join());
assert_ok!(th3.join());
});
}
#[test]
fn closing_unbounded_rx() {
loom::model(|| {
let (tx1, rx) = mpsc::unbounded_channel::<()>();
let tx2 = tx1.clone();
thread::spawn(move || {
drop(rx);
});
block_on(tx1.closed());
b... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | b5750825431afe6fe227a6fcf30a593b51ceff1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b5750825431afe6fe227a6fcf30a593b51ceff1b/tokio/src/sync/tests/loom_mpsc.rs | 81 | 134 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:4 | let (tx, mut rx) = mpsc::unbounded_channel::<()>();
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
drop(tx);
});
}
drop(tx);
let v = block_on(rx.recv());
assert!(v.is_none());
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | b5750825431afe6fe227a6fcf30a593b51ceff1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b5750825431afe6fe227a6fcf30a593b51ceff1b/tokio/src/sync/tests/loom_mpsc.rs | 121 | 134 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
#[test]
fn closing_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
drop(tx);
});
let v = bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:2 | }
#[test]
fn closing_bounded_rx() {
loom::model(|| {
let (mut tx1, rx) = mpsc::channel::<()>(16);
let mut tx2 = tx1.clone();
thread::spawn(move || {
drop(rx);
});
block_on(tx1.closed());
block_on(tx2.closed());
});
}
#[test]
fn closing_unbounded_rx(... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/tests/loom_mpsc.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:3 | }
drop(tx);
let v = block_on(rx.recv());
assert!(v.is_none());
});
}
#[test]
fn dropping_unbounded_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::unbounded_channel::<()>();
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/tests/loom_mpsc.rs | 81 | 105 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
#[test]
fn closing_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
drop(tx);
});
let v = bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:2 | }
#[test]
fn dropping_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel::<()>(16);
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
drop(tx);
});
}
drop(tx);
let v = block_on(rx.recv());
assert!... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/tests/loom_mpsc.rs | 41 | 77 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
#[test]
fn closing_tx() {
loom::model(|| {
let (mut tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
drop(tx);
});
let v = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 564da5c1289164d154b7d7b4ebbf33afb1e94803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/564da5c1289164d154b7d7b4ebbf33afb1e94803/tokio/src/sync/tests/loom_mpsc.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:2 | }
#[test]
fn dropping_tx() {
loom::model(|| {
let (tx, mut rx) = mpsc::channel::<()>(16);
for _ in 0..2 {
let tx = tx.clone();
thread::spawn(move || {
drop(tx);
});
}
drop(tx);
let v = block_on(poll_fn(|cx| rx.poll_recv(c... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 564da5c1289164d154b7d7b4ebbf33afb1e94803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/564da5c1289164d154b7d7b4ebbf33afb1e94803/tokio/src/sync/tests/loom_mpsc.rs | 41 | 77 |
tokio-rs/tokio:tokio/src/sync/tests/loom_mpsc.rs:1 | use crate::sync::mpsc;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
#[test]
fn closing_tx() {
loom::model(|| {
let (mut tx, mut rx) = mpsc::channel(16);
thread::spawn(move || {
tx.try_send(()).unwrap();
drop(tx);
});
let v = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_mpsc.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/sync/tests/loom_mpsc.rs | 1 | 23 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:1 | use crate::sync::Notify;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
use tokio_test::{assert_pending, assert_ready};
/// `util::wake_list::NUM_WAKERS`
const WAKE_LIST_SIZE: usize = 32;
#[test]
fn notify_one() {
loom::model(|| {
let tx = Arc::new(Notify::new());
let rx = tx... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | block_on(async {
notified1.await;
notified2.await;
});
th.join().unwrap();
});
}
#[test]
fn notify_waiters_and_one() {
loom::model(|| {
let notify = Arc::new(Notify::new());
let tx1 = notify.clone();
let tx2 = notify.clone();
let th1 = t... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | loom::model(|| {
let notify = Arc::new(Notify::new());
let mut threads = vec![];
for _ in 0..2 {
let notify = notify.clone();
threads.push(thread::spawn(move || {
block_on(async {
notify.notified().await;
notify.n... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:4 | block_on(poll_fn(|cx| {
if recv.as_mut().poll(cx).is_ready() {
rx1.notify_one();
}
Poll::Ready(())
}));
});
let th2 = thread::spawn(move || {
block_on(async {
rx2.notified().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:5 | }
let tx = notify.clone();
let th = thread::spawn(move || {
tx.notify_waiters();
});
let res1 = notified[0].poll();
let res2 = notified[1].poll();
// If res1 is ready, then res2 must also be ready.
assert!(res1.is_pending() || res2.is_ready());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:6 | for i in 2..futs.len() {
assert_pending!(futs[i].poll());
}
assert_pending!(futs[order[1]].poll());
let tx = notify.clone();
let th = thread::spawn(move || {
tx.notify_waiters();
});
let res1 = futs[0].poll();
let res2 = futs[1].poll();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:7 | let th = thread::spawn(move || {
tx.notify_waiters();
});
block_on(async {
// If awaiting one of the futures completes, then we should be
// able to assume that all pending futures are notified. Therefore
// a notification from a subsequent `notify_one` c... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:8 | let notify = Arc::new(Notify::new());
let (tx_fst, rx_fst) = oneshot::channel();
let (tx_snd, rx_snd) = oneshot::channel();
let receiver = thread::spawn({
let notify = notify.clone();
move || {
block_on(async {
// Poll the first `Noti... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 281 | 330 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:9 | });
// Wait for the signal and call `notify_waiters`.
block_on(rx_fst).unwrap();
notify.notify_waiters();
tx_snd.send(()).unwrap();
receiver.join().unwrap();
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_notify.rs | 321 | 330 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | block_on(async {
notified1.await;
notified2.await;
});
th.join().unwrap();
});
}
#[test]
fn notify_waiters_and_one() {
loom::model(|| {
let notify = Arc::new(Notify::new());
let tx1 = notify.clone();
let tx2 = notify.clone();
let th1 = t... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_notify.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | loom::model(|| {
let notify = Arc::new(Notify::new());
let mut ths = vec![];
for _ in 0..2 {
let notify = notify.clone();
ths.push(thread::spawn(move || {
block_on(async {
notify.notified().await;
notify.notify_on... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_notify.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | loom::model(|| {
let notify = Arc::new(Notify::new());
let mut ths = vec![];
for _ in 0..2 {
let notify = notify.clone();
ths.push(thread::spawn(move || {
block_on(async {
notify.notified().await;
notify.notify_on... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:4 | let mut recv = Box::pin(rx1.notified());
block_on(poll_fn(|cx| {
if recv.as_mut().poll(cx).is_ready() {
rx1.notify_one();
}
Poll::Ready(())
}));
});
let th2 = thread::spawn(move || {
block_on(async ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:5 | }
}
let tx = notify.clone();
let th = thread::spawn(move || {
tx.notify_waiters();
});
let res1 = notified[0].poll();
let res2 = notified[1].poll();
// If res1 is ready, then res2 must also be ready.
assert!(res1.is_pending() || res2.is_read... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:6 | assert_pending!(futs[order[0]].poll());
for i in 2..futs.len() {
assert_pending!(futs[i].poll());
}
assert_pending!(futs[order[1]].poll());
let tx = notify.clone();
let th = thread::spawn(move || {
tx.notify_waiters();
});
let res1 = futs... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:7 | let tx = notify.clone();
let th = thread::spawn(move || {
tx.notify_waiters();
});
block_on(async {
// If awaiting one of the futures completes, then we should be
// able to assume that all pending futures are notified. Therefore
// a notification... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:8 | loom::model(|| {
let notify = Arc::new(Notify::new());
let (tx_fst, rx_fst) = oneshot::channel();
let (tx_snd, rx_snd) = oneshot::channel();
let receiver = thread::spawn({
let notify = notify.clone();
move || {
block_on(async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 281 | 331 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:9 | }
});
// Wait for the signal and call `notify_waiters`.
block_on(rx_fst).unwrap();
notify.notify_waiters();
tx_snd.send(()).unwrap();
receiver.join().unwrap();
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 795754a846a29a0c785d4dadfb7a9136f8aba1ab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/795754a846a29a0c785d4dadfb7a9136f8aba1ab/tokio/src/sync/tests/loom_notify.rs | 321 | 331 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:1 | use crate::sync::Notify;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
#[test]
fn notify_one() {
loom::model(|| {
let tx = Arc::new(Notify::new());
let rx = tx.clone();
let th = thread::spawn(move || {
block_on(async {
rx.notified().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 6845a93cbf52ca8b0709918db0c8c558d6d8720e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6845a93cbf52ca8b0709918db0c8c558d6d8720e/tokio/src/sync/tests/loom_notify.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | th.join().unwrap();
});
}
#[test]
fn notify_waiters_and_one() {
loom::model(|| {
let notify = Arc::new(Notify::new());
let tx1 = notify.clone();
let tx2 = notify.clone();
let th1 = thread::spawn(move || {
tx1.notify_waiters();
});
let th2 = thread::... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 6845a93cbf52ca8b0709918db0c8c558d6d8720e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6845a93cbf52ca8b0709918db0c8c558d6d8720e/tokio/src/sync/tests/loom_notify.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | for _ in 0..2 {
let notify = notify.clone();
ths.push(thread::spawn(move || {
block_on(async {
notify.notified().await;
notify.notify_one();
})
}));
}
notify.notify_one();
for th in ths... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 6845a93cbf52ca8b0709918db0c8c558d6d8720e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6845a93cbf52ca8b0709918db0c8c558d6d8720e/tokio/src/sync/tests/loom_notify.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:4 | }
Poll::Ready(())
}));
});
let th2 = thread::spawn(move || {
block_on(async {
rx2.notified().await;
// Trigger second notification
rx2.notify_one();
rx2.notified().await;
});
});
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 6845a93cbf52ca8b0709918db0c8c558d6d8720e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6845a93cbf52ca8b0709918db0c8c558d6d8720e/tokio/src/sync/tests/loom_notify.rs | 121 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:1 | use crate::sync::Notify;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
#[test]
fn notify_one() {
loom::model(|| {
let tx = Arc::new(Notify::new());
let rx = tx.clone();
let th = thread::spawn(move || {
block_on(async {
rx.notified().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | d0ebb4154748166a4ba07baa4b424a1c45efd219 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/tests/loom_notify.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | });
});
}
#[test]
fn notify_multi() {
loom::model(|| {
let notify = Arc::new(Notify::new());
let mut ths = vec![];
for _ in 0..2 {
let notify = notify.clone();
ths.push(thread::spawn(move || {
block_on(async {
notify.notifie... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | d0ebb4154748166a4ba07baa4b424a1c45efd219 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/tests/loom_notify.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | loom::model(|| {
let notify = Arc::new(Notify::new());
let rx1 = notify.clone();
let rx2 = notify.clone();
let th1 = thread::spawn(move || {
let mut recv = Box::pin(rx1.notified());
block_on(poll_fn(|cx| {
if recv.as_mut().poll(cx).is_ready() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | d0ebb4154748166a4ba07baa4b424a1c45efd219 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/tests/loom_notify.rs | 81 | 111 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:1 | use crate::sync::Notify;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
#[test]
fn notify_one() {
loom::model(|| {
let tx = Arc::new(Notify::new());
let rx = tx.clone();
let th = thread::spawn(move || {
block_on(async {
rx.notified().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3/tokio/src/sync/tests/loom_notify.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | notify.notify_one();
for th in ths.drain(..) {
th.join().unwrap();
}
block_on(async {
notify.notified().await;
});
});
}
#[test]
fn notify_drop() {
use crate::future::poll_fn;
use std::future::Future;
use std::task::Poll;
loom::model(|| {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3/tokio/src/sync/tests/loom_notify.rs | 41 | 90 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | rx2.notified().await;
});
});
notify.notify_one();
th1.join().unwrap();
th2.join().unwrap();
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3/tokio/src/sync/tests/loom_notify.rs | 81 | 90 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:1 | use crate::sync::Notify;
use loom::future::block_on;
use loom::sync::Arc;
use loom::thread;
#[test]
fn notify_one() {
loom::model(|| {
let tx = Arc::new(Notify::new());
let rx = tx.clone();
let th = thread::spawn(move || {
block_on(async {
rx.notified().await;
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/src/sync/tests/loom_notify.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:2 | notify.notify();
for th in ths.drain(..) {
th.join().unwrap();
}
block_on(async {
notify.notified().await;
});
});
}
#[test]
fn notify_drop() {
use crate::future::poll_fn;
use std::future::Future;
use std::task::Poll;
loom::model(|| {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/src/sync/tests/loom_notify.rs | 41 | 90 |
tokio-rs/tokio:tokio/src/sync/tests/loom_notify.rs:3 | rx2.notified().await;
});
});
notify.notify();
th1.join().unwrap();
th2.join().unwrap();
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_notify.rs | MIT | 8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/src/sync/tests/loom_notify.rs | 81 | 90 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:1 | use crate::sync::oneshot;
use loom::future::block_on;
use loom::thread;
use std::future::poll_fn;
use std::pin::Pin;
use std::task::Poll::{Pending, Ready};
#[test]
fn smoke() {
loom::model(|| {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
tx.send(1).unwrap();
});... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:2 | if ready {
None
} else {
Some(rx)
}
})
.join()
.unwrap();
if let Some(rx) = rx {
// Previous task parked, use a new task...
let value = block_on(rx).unwrap();
assert_eq!(1, value);
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:3 | });
rx.close();
let _ = block_on(rx);
});
}
// TODO: Move this into `oneshot` proper.
use std::future::Future;
use std::task::{Context, Poll};
struct OnClose<'a> {
tx: &'a mut oneshot::Sender<i32>,
}
impl<'a> OnClose<'a> {
fn new(tx: &'a mut oneshot::Sender<i32>) -> Self {
OnClo... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:4 | });
let tx = thread::spawn(move || {
let t1 = block_on(OnClose::new(&mut tx));
if t1 {
None
} else {
Some(tx)
}
})
.join()
.unwrap();
if let Some(mut tx) = tx {
// Previous task parked,... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:5 | });
}
}
let mut builder = loom::model::Builder::new();
builder.preemption_bound = Some(2);
builder.check(|| {
let (tx, rx) = oneshot::channel();
// tx thread
let tx_thread_join_handle = thread::spawn(move || {
// Ensure that `Msg::drop` in this thread will ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 161 | 213 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:6 | Ready(())
}));
// Drop the receiver concurrently with the sender trying to send.
let rx_thread = thread::spawn(move || {
drop(rx);
});
let _ = tx.send(1);
rx_thread.join().unwrap();
});
} | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/tests/loom_oneshot.rs | 201 | 213 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:1 | use crate::sync::oneshot;
use loom::future::block_on;
use loom::thread;
use std::future::poll_fn;
use std::task::Poll::{Pending, Ready};
#[test]
fn smoke() {
loom::model(|| {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
tx.send(1).unwrap();
});
let value... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:2 | if ready {
None
} else {
Some(rx)
}
})
.join()
.unwrap();
if let Some(rx) = rx {
// Previous task parked, use a new task...
let value = block_on(rx).unwrap();
assert_eq!(1, value);
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:3 | rx.close();
let _ = block_on(rx);
});
}
// TODO: Move this into `oneshot` proper.
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
struct OnClose<'a> {
tx: &'a mut oneshot::Sender<i32>,
}
impl<'a> OnClose<'a> {
fn new(tx: &'a mut oneshot::Sender<i32>) -> Self {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_oneshot.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:5 | });
}
}
let mut builder = loom::model::Builder::new();
builder.preemption_bound = Some(2);
builder.check(|| {
let (tx, rx) = oneshot::channel();
// tx thread
let tx_thread_join_handle = thread::spawn(move || {
// Ensure that `Msg::drop` in this thread will ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/sync/tests/loom_oneshot.rs | 161 | 187 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:1 | use crate::sync::oneshot;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
use std::task::Poll::{Pending, Ready};
#[test]
fn smoke() {
loom::model(|| {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
tx.send(1).unwrap();
});
let v... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 18e048d7646e62ce893d606996fc91b983386def | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18e048d7646e62ce893d606996fc91b983386def/tokio/src/sync/tests/loom_oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:4 | });
let tx = thread::spawn(move || {
let t1 = block_on(OnClose::new(&mut tx));
if t1 {
None
} else {
Some(tx)
}
})
.join()
.unwrap();
if let Some(mut tx) = tx {
// Previous task parked,... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 4b78ed4d68107be1d4c723cd55bec8eecfdc540a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4b78ed4d68107be1d4c723cd55bec8eecfdc540a/tokio/src/sync/tests/loom_oneshot.rs | 121 | 140 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:1 | use crate::sync::oneshot;
use futures::future::poll_fn;
use loom::future::block_on;
use loom::thread;
use std::task::Poll::{Pending, Ready};
#[test]
fn smoke() {
loom::model(|| {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
tx.send(1).unwrap();
});
let v... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 7ec6d88b21ea3e5531176f526a51dae0a4513025 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ec6d88b21ea3e5531176f526a51dae0a4513025/tokio/src/sync/tests/loom_oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:2 | if ready {
None
} else {
Some(rx)
}
})
.join()
.unwrap();
if let Some(rx) = rx {
// Previous task parked, use a new task...
let value = block_on(rx).unwrap();
assert_eq!(1, value);
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 7ec6d88b21ea3e5531176f526a51dae0a4513025 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ec6d88b21ea3e5531176f526a51dae0a4513025/tokio/src/sync/tests/loom_oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/tests/loom_oneshot.rs:3 | Ready(fut.poll(cx).is_ready())
}
}
#[test]
fn changing_tx_task() {
loom::model(|| {
let (mut tx, rx) = oneshot::channel::<i32>();
thread::spawn(move || {
drop(rx);
});
let tx = thread::spawn(move || {
let t1 = block_on(OnClose::new(&mut tx));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/sync/tests/loom_oneshot.rs | MIT | 7ec6d88b21ea3e5531176f526a51dae0a4513025 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ec6d88b21ea3e5531176f526a51dae0a4513025/tokio/src/sync/tests/loom_oneshot.rs | 81 | 111 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.