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/tests/sync_mutex.rs:2
#[test] fn readiness() { let l1 = Arc::new(Mutex::new(100)); let l2 = Arc::clone(&l1); let mut t1 = spawn(l1.lock()); let mut t2 = spawn(l2.lock()); let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert_pending!(task.poll(&mut l)); std::thread::sleep(std::time::Duration::from_millis(500)); assert!(task.is_woken()); let result = assert_ready!(task.poll(&mut l)); assert!(*result); } */ /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. #[tokio::test] #[cfg(fe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
/// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex.rs
121
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:5
assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { let s = "debug"; let m = Mutex::new(s.to_string()); assert_eq!(format!("{s:?}"), format!("{:?}", m.lock().await)); } #[maybe_tokio_test] async fn mutex_debug() { let s = "data"; let m = Mutex::new(s.to_string()); assert_eq!(f...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex.rs
161
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
/// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mutex.rs
121
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:5
assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { let s = "debug"; let m = Mutex::new(s.to_string()); assert_eq!(format!("{:?}", s), format!("{:?}", m.lock().await)); } #[maybe_tokio_test] async fn mutex_debug() { let s = "data"; let m = Mutex::new(s.to_string()); assert_eq!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mutex.rs
161
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(tokio_wasm_not_wasi))] use tokio::test as maybe_tokio_test; use tokio::sync::Mutex; us...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff6fbc327dcd8f8d023dbe7b684d9ca13ac3aec4/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(tokio_wasm_not_wasi))] use tokio::test as maybe_tokio_test; use tokio::sync::Mutex; us...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:2
#[test] fn readiness() { let l1 = Arc::new(Mutex::new(100)); let l2 = Arc::clone(&l1); let mut t1 = spawn(l1.lock()); let mut t2 = spawn(l2.lock()); let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_mutex.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert_pending!(task.poll(&mut l)); std::thread::sleep(std::time::Duration::from_millis(500)); assert!(task.is_woken()); let result = assert_ready!(task.poll(&mut l)); assert!(*result); } */ /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. #[tokio::test] #[cfg(fe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_mutex.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
/// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_mutex.rs
121
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_family = "...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_arch = "wa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(target_arch = "wasm32"))] use tokio::test as maybe_tokio_test; use tokio::sync::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
/// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_mutex.rs
121
178
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Mutex; use tokio::time::{interval, timeout}; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; use std::sync::Arc; use std::time::Duration; #[test] fn straight_execution() { let l = Mutex::new(100); { le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:2
let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } /* #[test] #[ignore] fn lock() { let mut lock = Mutex::new(fal...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert!(*result); } */ #[tokio::test] /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. async fn aborted_future_1() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
// Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left for the mutex. timeout(Duration...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex.rs
121
164
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
// Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left for the mutex. timeout(Duration...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/tests/sync_mutex.rs
121
164
tokio-rs/tokio:tokio/tests/sync_mutex.rs:2
let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } /* #[test] #[ignore] fn lock() { let mut lock = Mutex::new(fal...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8fda719845e5bd90b5222a36155ae559de31a605
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fda719845e5bd90b5222a36155ae559de31a605/tokio/tests/sync_mutex.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert!(*result); } */ #[tokio::test] /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. async fn aborted_future_1() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8fda719845e5bd90b5222a36155ae559de31a605
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fda719845e5bd90b5222a36155ae559de31a605/tokio/tests/sync_mutex.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { m1.lock().await; }) .aw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
8fda719845e5bd90b5222a36155ae559de31a605
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8fda719845e5bd90b5222a36155ae559de31a605/tokio/tests/sync_mutex.rs
121
163
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { m1.lock().await; }) .aw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
e5b99b0f7a12ca27b390535b8628f87a61a08eb6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e5b99b0f7a12ca27b390535b8628f87a61a08eb6/tokio/tests/sync_mutex.rs
121
154
tokio-rs/tokio:tokio/tests/sync_mutex.rs:2
let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } /* #[test] #[ignore] fn lock() { let mut lock = Mutex::new(fal...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mutex.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert!(*result); } */ #[tokio::main] #[test] /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. async fn aborted_future_1() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted premat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mutex.rs
81
140
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left fo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
975576952f33c64e4faaa616f67ae9d6b596e4aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/tests/sync_mutex.rs
121
149
tokio-rs/tokio:tokio/tests/sync_mutex.rs:3
assert!(*result); } */ #[tokio::main] #[test] /// Ensure a mutex is unlocked if a future holding the lock /// is aborted prematurely. async fn aborted_future_1() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted premat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c632337e6f94013d9d39495f1d442351e6fbf6b6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c632337e6f94013d9d39495f1d442351e6fbf6b6/tokio/tests/sync_mutex.rs
81
136
tokio-rs/tokio:tokio/tests/sync_mutex.rs:4
let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { m2.lock().await; }) .await .unwrap_err(); } } // This should succeed as there is no lock left fo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
c632337e6f94013d9d39495f1d442351e6fbf6b6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c632337e6f94013d9d39495f1d442351e6fbf6b6/tokio/tests/sync_mutex.rs
121
136
tokio-rs/tokio:tokio/tests/sync_mutex.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Mutex; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; use std::sync::Arc; #[test] fn straight_execution() { let l = Mutex::new(100); { let mut t = spawn(l.lock()); let mut g = assert_ready!(t....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_mutex.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex.rs:2
// We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } /* #[test] #[ignore] fn lock() { let mut lock = Mutex::new(false); let mut lock2 = lock.clone();...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_mutex.rs
41
81
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_family = "...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:2
#[test] fn readiness() { let l = Arc::new(Mutex::new(100)); let mut t1 = spawn(l.clone().lock_owned()); let mut t2 = spawn(l.lock_owned()); let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
// This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { m1.lock_owned().await; }) .await .expect("Mutex is locked"); } /// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex_owned.rs
81
137
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:4
let m: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let g1 = m.clone().try_lock_owned(); assert!(g1.is_ok()); let g2 = m.clone().try_lock_owned(); assert!(g2.is_err()); } let g3 = m.try_lock_owned(); assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_mutex_owned.rs
121
137
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
// This should succeed as there is no lock left for the mutex. timeout(Duration::from_millis(1u64), async move { m1.lock_owned().await; }) .await .expect("Mutex is locked"); } /// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/sync_mutex_owned.rs
81
137
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:4
let m: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { let g1 = m.clone().try_lock_owned(); assert!(g1.is_ok()); let g2 = m.clone().try_lock_owned(); assert!(g2.is_err()); } let g3 = m.try_lock_owned(); assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/sync_mutex_owned.rs
121
137
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:2
#[test] fn readiness() { let l = Arc::new(Mutex::new(100)); let mut t1 = spawn(l.clone().lock_owned()); let mut t2 = spawn(l.lock_owned()); let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mutex_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
timeout(Duration::from_millis(1u64), async move { m1.lock_owned().await; }) .await .expect("Mutex is locked"); } /// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mutex_owned.rs
81
136
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:4
{ let g1 = m.clone().try_lock_owned(); assert!(g1.is_ok()); let g2 = m.clone().try_lock_owned(); assert!(g2.is_err()); } let g3 = m.try_lock_owned(); assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { let s = "debug"; let m = Arc::new(Mutex::new(s.t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_mutex_owned.rs
121
136
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(tokio_wasm_not_wasi))] use tokio::test as maybe_tokio_test; use tokio::sync::Mutex; us...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(all(target_arch = "wa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test; #[cfg(not(target_arch = "wasm32"))] use tokio::test as maybe_tokio_test; use tokio::sync::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
dee26c92ddb32e23acb0c1587e775ddab29e07f9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/dee26c92ddb32e23acb0c1587e775ddab29e07f9/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
timeout(Duration::from_millis(1u64), async move { m1.lock_owned().await; }) .await .expect("Mutex is locked"); } /// This test is similar to `aborted_future_1` but this time the /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] async fn aborted_future_2() { use...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_mutex_owned.rs
81
136
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:4
{ let g1 = m.clone().try_lock_owned(); assert!(g1.is_ok()); let g2 = m.clone().try_lock_owned(); assert!(!g2.is_ok()); } let g3 = m.try_lock_owned(); assert!(g3.is_ok()); } #[maybe_tokio_test] async fn debug_format() { let s = "debug"; let m = Arc::new(Mutex::new(s.t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_mutex_owned.rs
121
136
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Mutex; use tokio::time::{interval, timeout}; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; use std::sync::Arc; use std::time::Duration; #[test] fn straight_execution() { let l = Arc::new(Mutex::new(100)); { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:2
let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } #[tokio::test] /// Ensure a mutex is unlocked if a future holding ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
async fn aborted_future_2() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mutex let _lock = m1.clone().lock_owned().await; { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_mil...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
8198ef38814c45f9dc02fcbf826225b5cf32a6bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8198ef38814c45f9dc02fcbf826225b5cf32a6bb/tokio/tests/sync_mutex_owned.rs
81
122
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
async fn aborted_future_2() { let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mutex let _lock = m1.clone().lock_owned().await; { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_mil...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
ae67851f11b7cc1f577de8ce21767ce3e2c7aff9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ae67851f11b7cc1f577de8ce21767ce3e2c7aff9/tokio/tests/sync_mutex_owned.rs
81
122
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:2
let g = assert_ready!(t1.poll()); // We can't now acquire the lease since it's already held in g assert_pending!(t2.poll()); // But once g unlocks, we can acquire it drop(g); assert!(t2.is_woken()); assert_ready!(t2.poll()); } #[tokio::test] /// Ensure a mutex is unlocked if a future holding ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
9264b837d897dcdf974703a6739132b995e669bc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/sync_mutex_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:3
let m1: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); { // Lock mutex let _lock = m1.clone().lock_owned().await; { let m2 = m1.clone(); // Try to lock mutex in a future that is aborted prematurely timeout(Duration::from_millis(1u64), async move { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
9264b837d897dcdf974703a6739132b995e669bc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9264b837d897dcdf974703a6739132b995e669bc/tokio/tests/sync_mutex_owned.rs
81
121
tokio-rs/tokio:tokio/tests/sync_mutex_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Mutex; use tokio::time::{interval, timeout}; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; use std::sync::Arc; use std::time::Duration; #[test] fn straight_execution() { let l = Arc::new(Mutex::new(100)); { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_mutex_owned.rs
MIT
45773c56413267cbcf9d5e7877e8dc4afc1e5b07
github
async-runtime
https://github.com/tokio-rs/tokio/blob/45773c56413267cbcf9d5e7877e8dc4afc1e5b07/tokio/tests/sync_mutex_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; #[allow(unused)] trait AssertSend: Send + Sync {} impl AssertSend for Notify {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:2
fn notify_multi_notified_last() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); // add two waiters into the queue assert_pending!(notified1.poll()); assert_pending!(notified2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
41
100
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_ready!(notified1.poll()); assert_pending!(notified2.poll()); } #[test] fn notify_notified_multi() { let notify = Notify::new(); notify.notify_one(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_ready...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
81
140
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.poll()); notify.notify_one(); assert!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
121
180
tokio-rs/tokio:tokio/tests/sync_notify.rs:5
#[test] fn notified_multi_notify_last_drop() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); let mut notified3 = spawn(async { notify.notified().await }); // add waiters by order of poll execut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
161
220
tokio-rs/tokio:tokio/tests/sync_notify.rs:6
} let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::from_waker(&waker); assert!(fut.as_mut().poll(&mut cx).is_pending()); } // Now, notifying **sh...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
201
260
tokio-rs/tokio:tokio/tests/sync_notify.rs:7
} #[test] fn test_notify_one_after_enable() { let notify = Notify::new(); let mut future = spawn(notify.notified()); future.enter(|_, fut| assert!(!fut.enable())); notify.notify_one(); assert_ready!(future.poll()); future.enter(|_, fut| assert!(fut.enable())); } #[test] fn test_poll_after_en...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
241
300
tokio-rs/tokio:tokio/tests/sync_notify.rs:8
future1.enter(|_, fut| assert!(fut.enable())); let mut future2 = spawn(notify.notified()); future2.enter(|_, fut| assert!(!fut.enable())); } #[test] fn test_waker_update() { use futures::task::noop_waker; use std::future::Future; use std::task::Context; let notify = Notify::new(); let mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify.rs
281
315
tokio-rs/tokio:tokio/tests/sync_notify.rs:8
future1.enter(|_, fut| assert!(fut.enable())); let mut future2 = spawn(notify.notified()); future2.enter(|_, fut| assert!(!fut.enable())); } #[test] fn test_waker_update() { use futures::task::noop_waker; use std::future::Future; use std::task::Context; let notify = Notify::new(); let mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
9e00b266e08d263c497dc9de57d9acbc049ae69b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9e00b266e08d263c497dc9de57d9acbc049ae69b/tokio/tests/sync_notify.rs
281
303
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; #[allow(unused)] trait AssertSend: Send + Sync {} impl AssertSend for Notify {} ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:2
assert_pending!(notified1.poll()); assert_pending!(notified2.poll()); notify.notify_one(); assert!(notified1.is_woken()); assert!(!notified2.is_woken()); assert_ready!(notified1.poll()); assert_pending!(notified2.poll()); } #[test] fn notify_notified_multi() { let notify = Notify::new(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
41
100
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_pending!(notified2.poll()); notify.notify_one(); assert!(notified2.is_woken()); assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
81
140
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
impl Drop for NotifyOnDrop { fn drop(&mut self) { self.0.notify_waiters(); } } let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::fr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
121
180
tokio-rs/tokio:tokio/tests/sync_notify.rs:5
let notify = Notify::new(); let mut future = spawn(notify.notified()); notify.notify_one(); assert_ready!(future.poll()); } #[test] fn test_notify_one_after_enable() { let notify = Notify::new(); let mut future = spawn(notify.notified()); future.enter(|_, fut| assert!(!fut.enable())); no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
161
220
tokio-rs/tokio:tokio/tests/sync_notify.rs:6
// Add a permit. notify.notify_one(); let mut future1 = spawn(notify.notified()); future1.enter(|_, fut| assert!(fut.enable())); let mut future2 = spawn(notify.notified()); future2.enter(|_, fut| assert!(!fut.enable())); } #[test] fn test_waker_update() { use futures::task::noop_waker; us...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
be9328da75c34b14dbbf017c344fee6219985559
github
async-runtime
https://github.com/tokio-rs/tokio/blob/be9328da75c34b14dbbf017c344fee6219985559/tokio/tests/sync_notify.rs
201
228
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notif...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
notify.notify_one(); assert!(notified2.is_woken()); assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_notify.rs
81
140
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
impl Drop for NotifyOnDrop { fn drop(&mut self) { self.0.notify_waiters(); } } let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::fr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_notify.rs
121
180
tokio-rs/tokio:tokio/tests/sync_notify.rs:5
let mut future = spawn(notify.notified()); notify.notify_one(); assert_ready!(future.poll()); } #[test] fn test_notify_one_after_enable() { let notify = Notify::new(); let mut future = spawn(notify.notified()); future.enter(|_, fut| assert!(!fut.enable())); notify.notify_one(); assert_re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/sync_notify.rs
161
220
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notify_notified_one() { let notify...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notif...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notify_notified_one() { let not...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
c7280167db887bda9d6e6c009bf1c229268254d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7280167db887bda9d6e6c009bf1c229268254d6/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:5
let mut future = spawn(notify.notified()); notify.notify_one(); assert_ready!(future.poll()); } #[test] fn test_notify_one_after_enable() { let notify = Notify::new(); let mut future = spawn(notify.notified()); future.enter(|_, fut| assert!(!fut.enable())); notify.notify_one(); assert_re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
a7e7eca893e7df1396b42a98943ccfb64a5bc74b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7e7eca893e7df1396b42a98943ccfb64a5bc74b/tokio/tests/sync_notify.rs
161
209
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
impl Drop for NotifyOnDrop { fn drop(&mut self) { self.0.notify_waiters(); } } let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::fr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
2747043f6f7e0870cc5aa72c146dfae9543c5ba8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/sync_notify.rs
121
156
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notify_notified_one() { let notify = Notify::new(); let mut notified = spawn(async { notify.notified().await ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:2
notify.notify_one(); assert!(notified1.is_woken()); assert!(!notified2.is_woken()); assert_ready!(notified1.poll()); assert_pending!(notified2.poll()); } #[test] fn notify_notified_multi() { let notify = Notify::new(); notify.notify_one(); let mut notified1 = spawn(async { notify.notifie...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b/tokio/tests/sync_notify.rs
41
100
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b/tokio/tests/sync_notify.rs
81
140
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
} } let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::from_waker(&waker); assert!(fut.as_mut().poll(&mut cx).is_pending()); } // Now, notifyin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f7c181c2c49ee28d7cb0773f5cdb4bec35b5a89b/tokio/tests/sync_notify.rs
121
153
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/tests/sync_notify.rs
81
136
tokio-rs/tokio:tokio/tests/sync_notify.rs:4
} } let mut fut = Box::pin(async { notify.notified().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::from_waker(&waker); assert!(fut.as_mut().poll(&mut cx).is_pending()); } // Now, notifyin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/tests/sync_notify.rs
121
136
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38ec4845d14c25b9d89cb6fbdf2a5c5472971fc3/tokio/tests/sync_notify.rs
81
102
tokio-rs/tokio:tokio/tests/sync_notify.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; trait AssertSend: Send + Sync {} impl AssertSend for Notify {} #[test] fn notify_notified_one() { let notify = Notify::new(); let mut notified = spawn(async { notify.notified().await ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/tests/sync_notify.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify.rs:2
notify.notify(); assert!(notified1.is_woken()); assert!(!notified2.is_woken()); assert_ready!(notified1.poll()); assert_pending!(notified2.poll()); } #[test] fn notify_notified_multi() { let notify = Notify::new(); notify.notify(); let mut notified1 = spawn(async { notify.notified().awai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/tests/sync_notify.rs
41
100
tokio-rs/tokio:tokio/tests/sync_notify.rs:3
assert_ready!(notified2.poll()); } #[test] fn notified_multi_notify_drop_one() { let notify = Notify::new(); let mut notified1 = spawn(async { notify.notified().await }); let mut notified2 = spawn(async { notify.notified().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify.rs
MIT
8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8b7ea0ff5cad2522d3113b77e9b6d95b507dee3b/tokio/tests/sync_notify.rs
81
102
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "sync")] #[cfg(all(target_family = "wasm", not(target_os = "wasi")))] use wasm_bindgen_test::wasm_bindgen_test as test; use std::sync::Arc; use tokio::sync::Notify; use tokio_test::task::spawn; use tokio_test::*; #[allow(unused)] trait AssertSend: Send + Sync {} impl Asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
1
60
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:2
#[test] fn notify_multi_notified_last() { let notify = Arc::new(Notify::new()); let mut notified1 = spawn(async { notify.clone().notified_owned().await }); let mut notified2 = spawn(async { notify.clone().notified_owned().await }); // add two waiters into the queue assert_pending!(notified1.poll())...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
41
100
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:3
assert_ready!(notified1.poll()); assert_pending!(notified2.poll()); } #[test] fn notify_notified_multi() { let notify = Arc::new(Notify::new()); notify.notify_one(); let mut notified1 = spawn(async { notify.clone().notified_owned().await }); let mut notified2 = spawn(async { notify.clone().notifi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
81
140
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:4
#[test] fn notified_multi_notify_drop_one() { let notify = Arc::new(Notify::new()); let mut notified1 = spawn(async { notify.clone().notified_owned().await }); let mut notified2 = spawn(async { notify.clone().notified_owned().await }); assert_pending!(notified1.poll()); assert_pending!(notified2.po...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
121
180
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:5
} #[test] fn notified_multi_notify_last_drop() { let notify = Arc::new(Notify::new()); let mut notified1 = spawn(async { notify.clone().notified_owned().await }); let mut notified2 = spawn(async { notify.clone().notified_owned().await }); let mut notified3 = spawn(async { notify.clone().notified_owned(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
161
220
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:6
} } let mut fut = Box::pin(async { notify.clone().notified_owned().await; }); { let waker = futures::task::waker(Arc::new(NotifyOnDrop(notify.clone()))); let mut cx = std::task::Context::from_waker(&waker); assert!(fut.as_mut().poll(&mut cx).is_pending()); } //...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
201
260
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:7
assert_ready!(future.poll()); } #[test] fn test_notify_one_after_enable() { let notify = Arc::new(Notify::new()); let mut future = spawn(notify.clone().notified_owned()); future.enter(|_, fut| assert!(!fut.enable())); notify.notify_one(); assert_ready!(future.poll()); future.enter(|_, fut| as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
241
300
tokio-rs/tokio:tokio/tests/sync_notify_owned.rs:8
let mut future1 = spawn(notify.clone().notified_owned()); future1.enter(|_, fut| assert!(fut.enable())); let mut future2 = spawn(notify.clone().notified_owned()); future2.enter(|_, fut| assert!(!fut.enable())); } #[test] fn test_waker_update() { use futures::task::noop_waker; use std::future::Futu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_notify_owned.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_notify_owned.rs
281
304
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::mem; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; use std::time::Duration; use tokio::runtime; use tokio::sync::OnceCell; use tokio::sync::SetError; use tokio::time; struct Foo { value: Arc<AtomicU32>, } impl Drop for Foo { fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
1
60
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:2
fn drop_cell_new_with() { let num_drops = Arc::new(AtomicU32::new(0)); { let once_cell = OnceCell::new_with(Some(Foo::from(num_drops.clone()))); assert!(once_cell.initialized()); } assert!(num_drops.load(Ordering::Acquire) == 1); } #[test] fn drop_into_inner() { let num_drops = Arc:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
41
100
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:3
assert_eq!(*cell.get().unwrap(), 2); } async fn func1() -> u32 { 5 } async fn func2() -> u32 { time::sleep(Duration::from_millis(1)).await; 10 } async fn func_err() -> Result<u32, ()> { Err(()) } async fn func_ok() -> Result<u32, ()> { Ok(10) } async fn func_panic() -> u32 { time::sleep(Dur...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
81
140
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:4
let rt = runtime::Builder::new_current_thread() .enable_time() .start_paused(true) .build() .unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { let handle1 = rt.spawn(async { ONCE.get_or_init(func1).await }); let handle2 = rt.spawn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
121
180
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:5
let result1 = handle1.await.unwrap(); let result2 = handle2.await.unwrap(); assert_eq!(*result1, 5); assert_eq!(*result2, 5); }); } #[test] fn set_and_get() { let rt = runtime::Builder::new_current_thread() .enable_time() .build() .unwrap(); static ONCE: On...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
161
220
tokio-rs/tokio:tokio/tests/sync_once_cell.rs:6
#[test] fn set_while_initializing() { let rt = runtime::Builder::new_current_thread() .enable_time() .build() .unwrap(); static ONCE: OnceCell<u32> = OnceCell::const_new(); rt.block_on(async { time::pause(); let handle1 = rt.spawn(async { ONCE.get_or_init(sleep_and...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_once_cell.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/sync_once_cell.rs
201
250