id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/runtime/thread_pool/spawner.rs:1
use crate::loom::sync::Arc; use crate::runtime::park::Unpark; use crate::runtime::thread_pool::slice; use crate::task::JoinHandle; use std::fmt; use std::future::Future; /// Submit futures to the associated thread pool for execution. /// /// A `Spawner` instance is a handle to a single thread pool, allowing the owner...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/spawner.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/spawner.rs
1
58
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::{self, Runtime}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; #[test] fn racy_shutdown() { loom::mod...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
// Spawn a task let c2 = c1.clone(); let tx2 = tx1.clone(); pool.spawn(async move { spawn(async move { if 1 == c1.fetch_add(1, Relaxed) { tx1.lock().unwrap().take().unwrap().send(()); } }); }); // Spawn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:3
drop(pool); }); } #[test] fn only_blocking() { only_blocking_inner(false) } #[test] fn only_blocking_with_pending() { only_blocking_inner(true) } fn blocking_and_regular_inner(first_pending: bool) { const NUM: usize = 3; loom::model(move || { let pool = mk_pool(1); let cnt = Arc::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
} }); } done_rx.recv(); block_rx.recv(); drop(pool); }); } #[test] fn blocking_and_regular() { blocking_and_regular_inner(false); } #[test] fn blocking_and_regular_with_pending() { blocking_and_regular_inner(true); } #[test] fn pool_multi_notify() { loom:...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
} }); // Spawn a second task pool.spawn(async move { gated().await; gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
pool.block_on({ futures::future::lazy(|_| ()).then(|_| { // Spin hard crate::spawn(async { for _ in 0..2 { yield_once().await; } }); gated2(true) }) }); })...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
}); } fn mk_pool(num_threads: usize) -> Runtime { runtime::Builder::new() .threaded_scheduler() .core_threads(num_threads) .build() .unwrap() } use futures::future::poll_fn; use std::task::Poll; async fn yield_once() { let mut yielded = false; poll_fn(|cx| { if yiel...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:8
if !fired { let gate = gate.clone(); let waker = cx.waker().clone(); if thread { thread::spawn(move || { gate.store(true, Release); waker.wake_by_ref(); }); } else { spawn(async move ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
55b5e1b6adcc3f85a35d16444e496b203648c99d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55b5e1b6adcc3f85a35d16444e496b203648c99d/tokio/src/runtime/thread_pool/tests/loom_pool.rs
281
308
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::{self, Runtime}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; #[test] fn pool_multi_spawn() { loom::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
}); } fn only_blocking_inner(first_pending: bool) { loom::model(move || { let pool = mk_pool(1); let (block_tx, block_rx) = oneshot::channel(); pool.spawn(async move { crate::task::block_in_place(move || { block_tx.send(()); }); if first_...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:3
let done_tx = Arc::new(Mutex::new(Some(done_tx))); pool.spawn(async move { crate::task::block_in_place(move || { block_tx.send(()); }); if first_pending { yield_once().await } }); for _ in 0..NUM { let ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
fn pool_multi_notify() { loom::model(|| { let pool = mk_pool(2); let c1 = Arc::new(AtomicUsize::new(0)); let (done_tx, done_rx) = oneshot::channel(); let done_tx1 = Arc::new(Mutex::new(Some(done_tx))); // Spawn a task let c2 = c1.clone(); let done_tx2 = don...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
pool.spawn(async move { gated2(true).await; }); pool.spawn(async move { gated2(false).await; }); drop(pool); }); } #[test] fn complete_block_on_under_load() { use futures::FutureExt; loom::model(|| { let mut pool = mk_pool(2); pool...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
let rt = mk_pool(2); let (done_tx, done_rx) = oneshot::channel::<()>(); rt.spawn(async move { let (mut tx, mut rx) = mpsc::channel::<()>(10); crate::spawn(async move { crate::task::spawn_blocking(move || { let _ = tx.try_send(()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
Poll::Pending } }) .await } fn gated() -> impl Future<Output = &'static str> { gated2(false) } fn gated2(thread: bool) -> impl Future<Output = &'static str> { use loom::thread; use std::sync::Arc; let gate = Arc::new(AtomicBool::new(false)); let mut fired = false; poll_fn(mov...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
a16c9a5a018af21ce48895207564a74c7feacc8b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a16c9a5a018af21ce48895207564a74c7feacc8b/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
286
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::{self, Runtime}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; #[test] fn pool_multi_spawn() { loom::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
}); } #[test] fn only_blocking() { loom::model(|| { let pool = mk_pool(1); let (block_tx, block_rx) = oneshot::channel(); pool.spawn(async move { crate::task::block_in_place(move || { block_tx.send(()); }) }); block_rx.recv(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:3
pool.spawn(async move { if NUM == cnt.fetch_add(1, Relaxed) + 1 { done_tx.lock().unwrap().take().unwrap().send(()); } }); } done_rx.recv(); block_rx.recv(); drop(pool); }); } #[test] fn pool_multi_notify() { loom:...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let pool = mk_pool(2); pool.spawn(async move { ga...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
yield_once().await; } }); gated2(true) }) }); }); } #[test] fn shutdown_with_notification() { use crate::stream::StreamExt; use crate::sync::{mpsc, oneshot}; loom::model(|| { let rt = mk_pool(2); let (done_tx, don...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
.core_threads(num_threads) .build() .unwrap() } use futures::future::poll_fn; use std::task::Poll; async fn yield_once() { let mut yielded = false; poll_fn(|cx| { if yielded { Poll::Ready(()) } else { loom::thread::yield_now(); yielded = true;...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
gate.store(true, Release); waker.wake_by_ref(); }); } else { spawn(async move { gate.store(true, Release); waker.wake_by_ref(); }); } fired = true; return Poll::P...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
275769b5b90e9cf33c8d37f1ba176cacb508399e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/275769b5b90e9cf33c8d37f1ba176cacb508399e/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
262
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let pool = mk_pool(2); pool.spawn(async move { ga...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
yield_once().await; } }); gated2(true) }) }); }); } fn mk_pool(num_threads: usize) -> Runtime { runtime::Builder::new() .threaded_scheduler() .core_threads(num_threads) .build() .unwrap() } use futures::fu...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
use loom::thread; use std::sync::Arc; let gate = Arc::new(AtomicBool::new(false)); let mut fired = false; poll_fn(move |cx| { if !fired { let gate = gate.clone(); let waker = cx.waker().clone(); if thread { thread::spawn(move || { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
235
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::{self, Runtime}; use crate::runtime::tests::loom_oneshot as oneshot; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, Release}; #[test] fn pool_multi_spawn() { loom::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let pool = mk_pool(2); pool.spawn(async move { ga...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
yield_once().await; } }); gated2(true) }) }); }); } fn mk_pool(num_threads: usize) -> Runtime { runtime::Builder::new() .threaded_scheduler() .num_threads(num_threads) .build() .unwrap() } use futures::fut...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::thread_pool::ThreadPool; use crate::runtime::{Park, Unpark}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex, Notify}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, R...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
rx.recv(); }); } #[test] fn only_blocking() { loom::model(|| { let mut pool = mk_pool(1); let (block_tx, block_rx) = oneshot::channel(); pool.spawn(async move { crate::task::block_in_place(move || { block_tx.send(()); }) }); bloc...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:3
let cnt = cnt.clone(); let done_tx = done_tx.clone(); pool.spawn(async move { if NUM == cnt.fetch_add(1, Relaxed) + 1 { done_tx.lock().unwrap().take().unwrap().send(()); } }); } done_rx.recv(); block_rx.rec...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
pool.spawn(async move { gated().await; gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let poo...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
crate::spawn(async { for _ in 0..2 { yield_once().await; } }); gated2(true) }) }); }); } fn mk_pool(num_threads: usize) -> Runtime { use crate::blocking::BlockingPool; let blocking_pool = B...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
Poll::Pending } }) .await } fn gated() -> impl Future<Output = &'static str> { gated2(false) } fn gated2(thread: bool) -> impl Future<Output = &'static str> { use loom::thread; use std::sync::Arc; let gate = Arc::new(AtomicBool::new(false)); let mut fired = false; poll_fn(mov...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
Poll::Ready("hello world") } else { Poll::Pending } }) } /// Fake runtime struct Runtime { executor: ThreadPool, #[allow(dead_code)] blocking_pool: crate::blocking::BlockingPool, } use std::ops; impl ops::Deref for Runtime { type Target = ThreadPool; fn deref(&sel...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:8
LoomPark { notify: Arc::new(Notify::new()), } } } impl Park for LoomPark { type Unpark = LoomUnpark; type Error = (); fn unpark(&self) -> LoomUnpark { let notify = self.notify.clone(); LoomUnpark { notify } } fn park(&mut self) -> Result<(), Self::Error> {...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
b1d9e55487d8411da89788ce0fbb3eb99a1f3a40
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b1d9e55487d8411da89788ce0fbb3eb99a1f3a40/tokio/src/runtime/thread_pool/tests/loom_pool.rs
281
312
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::thread_pool::ThreadPool; use crate::runtime::{Park, Unpark}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex, Notify}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Relaxed, R...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
rx.recv(); }); } #[test] fn only_blocking() { loom::model(|| { let mut pool = mk_pool(1); let (block_tx, block_rx) = oneshot::channel(); pool.spawn(async move { crate::blocking::in_place(move || { block_tx.send(()); }) }); block_...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
19f1fc36bd567377bde4a2c6818c6b606d89d488
github
async-runtime
https://github.com/tokio-rs/tokio/blob/19f1fc36bd567377bde4a2c6818c6b606d89d488/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
pool.spawn(async move { gated().await; gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let poo...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
} }); gated2(true).await }); }); } fn mk_pool(num_threads: usize) -> Runtime { use crate::blocking::BlockingPool; let blocking_pool = BlockingPool::new("test".into(), None); let executor = ThreadPool::new( num_threads, blocking_pool.spawner().clone(), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
} fn gated() -> impl Future<Output = &'static str> { gated2(false) } fn gated2(thread: bool) -> impl Future<Output = &'static str> { use loom::thread; use std::sync::Arc; let gate = Arc::new(AtomicBool::new(false)); let mut fired = false; poll_fn(move |cx| { if !fired { l...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
}) } /// Fake runtime struct Runtime { executor: ThreadPool, #[allow(dead_code)] blocking_pool: crate::blocking::BlockingPool, } use std::ops; impl ops::Deref for Runtime { type Target = ThreadPool; fn deref(&self) -> &ThreadPool { &self.executor } } impl ops::DerefMut for Runtime {...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:8
} impl Park for LoomPark { type Unpark = LoomUnpark; type Error = (); fn unpark(&self) -> LoomUnpark { let notify = self.notify.clone(); LoomUnpark { notify } } fn park(&mut self) -> Result<(), Self::Error> { self.notify.wait(); Ok(()) } fn park_timeout(&...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_pool.rs
281
308
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:1
use crate::runtime::tests::loom_oneshot as oneshot; use crate::runtime::thread_pool::{self, ThreadPool}; use crate::runtime::{Park, Unpark}; use crate::spawn; use loom::sync::atomic::{AtomicBool, AtomicUsize}; use loom::sync::{Arc, Mutex, Notify}; use std::future::Future; use std::sync::atomic::Ordering::{Acquire, Re...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:2
rx.recv(); }); } #[test] fn only_blocking() { loom::model(|| { let mut pool = mk_pool(1); let (block_tx, block_rx) = oneshot::channel(); pool.spawn(async move { thread_pool::blocking(move || { block_tx.send(()); }) }); block_rx.r...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:4
pool.spawn(async move { gated().await; gated().await; if 1 == c2.fetch_add(1, Relaxed) { done_tx2.lock().unwrap().take().unwrap().send(()); } }); done_rx.recv(); }); } #[test] fn pool_shutdown() { loom::model(|| { let poo...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:5
} }); gated2(true).await }); }); } fn mk_pool(num_threads: usize) -> ThreadPool { use crate::runtime::blocking; ThreadPool::new( num_threads, blocking::Pool::new("test".into(), None), Arc::new(Box::new(|_, next| next())), move |_| LoomPark::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:6
fn gated2(thread: bool) -> impl Future<Output = &'static str> { use loom::thread; use std::sync::Arc; let gate = Arc::new(AtomicBool::new(false)); let mut fired = false; poll_fn(move |cx| { if !fired { let gate = gate.clone(); let waker = cx.waker().clone(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_pool.rs:7
struct LoomUnpark { notify: Arc<Notify>, } impl LoomPark { fn new() -> LoomPark { LoomPark { notify: Arc::new(Notify::new()), } } } impl Park for LoomPark { type Unpark = LoomUnpark; type Error = (); fn unpark(&self) -> LoomUnpark { let notify = self.notif...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/loom_pool.rs
241
279
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_queue.rs:1
use crate::runtime::thread_pool::queue; use crate::task::{self, Task}; use crate::tests::mock_schedule::{Noop, NOOP_SCHEDULE}; use loom::thread; use std::cell::Cell; use std::rc::Rc; #[test] fn multi_worker() { const THREADS: usize = 2; const PER_THREAD: usize = 7; fn work(_i: usize, q: queue::Worker<No...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_queue.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/thread_pool/tests/loom_queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_queue.rs:2
thread::yield_now(); } } loom::model(|| { let rem = Rc::new(Cell::new(THREADS * PER_THREAD)); let mut qs = queue::build(THREADS); let q1 = qs.remove(0); for i in 1..THREADS { let q = qs.remove(0); let rem = rem.clone(); thread::spawn...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_queue.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/thread_pool/tests/loom_queue.rs
41
69
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/loom_queue.rs:2
thread::yield_now(); } } loom::model(|| { let rem = Rc::new(Cell::new(THREADS * PER_THREAD)); let mut qs = queue::build(THREADS); let q1 = qs.remove(0); for i in 1..THREADS { let q = qs.remove(0); let rem = rem.clone(); thread::spawn...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/loom_queue.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/loom_queue.rs
41
68
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/mod.rs:1
#[cfg(loom)] mod loom_pool; #[cfg(loom)] mod loom_queue; #[cfg(not(loom))] mod queue;
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/mod.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/thread_pool/tests/mod.rs
1
8
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/mod.rs:1
#[cfg(loom)] mod loom_pool; #[cfg(loom)] mod loom_queue; #[cfg(not(loom))] mod pool; #[cfg(not(loom))] mod queue;
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/mod.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/mod.rs
1
11
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:1
#![warn(rust_2018_idioms)] use crate::blocking; use crate::runtime::thread_pool::ThreadPool; use crate::runtime::{Park, Unpark}; use futures::future::poll_fn; use std::future::Future; use std::pin::Pin; use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::*; use std::sync::{mpsc, Arc}; use std::task::{Con...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:2
Ok(()) } fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> { let _ = self.rx.recv_timeout(duration); Ok(()) } } struct MyUnpark { tx: Mutex<mpsc::Sender<()>>, #[allow(dead_code)] unpark_tx: mpsc::SyncSender<()>, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:3
}, ); struct MyTask { task_tx: Option<mpsc::Sender<Waker>>, drop_tx: mpsc::Sender<()>, } impl Future for MyTask { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { if let Some(tx) = self.get_mut().task_tx.take() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:4
// If the future is forcefully dropped, then we will get a signal here. drop_rx.recv().unwrap(); // Ensure `task` lives until after the test completes. drop(task); } #[test] fn park_called_at_interval() { struct MyPark { park_light: Arc<AtomicBool>, } struct MyUnpark {} impl Park...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:5
} impl Unpark for MyUnpark { fn unpark(&self) {} } let park_light_1 = Arc::new(AtomicBool::new(false)); let park_light_2 = park_light_1.clone(); let (done_tx, done_rx) = mpsc::channel(); let blocking_pool = blocking::BlockingPool::new("test".into(), None); let pool = ThreadPool:...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/pool.rs
161
206
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:1
#![warn(rust_2018_idioms)] use crate::blocking; use crate::runtime::thread_pool::ThreadPool; use crate::runtime::{Park, Unpark}; use futures_util::future::poll_fn; use std::future::Future; use std::pin::Pin; use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::*; use std::sync::{mpsc, Arc}; use std::task:...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:1
#![warn(rust_2018_idioms)] use crate::runtime::thread_pool::ThreadPool; use crate::runtime::{blocking, Park, Unpark}; use futures_util::future::poll_fn; use std::future::Future; use std::pin::Pin; use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::*; use std::sync::{mpsc, Arc}; use std::task::{Context, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:2
} fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> { let _ = self.rx.recv_timeout(duration); Ok(()) } } struct MyUnpark { tx: Mutex<mpsc::Sender<()>>, #[allow(dead_code)] unpark_tx: mpsc::SyncSender<()>, } impl U...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:3
struct MyTask { task_tx: Option<mpsc::Sender<Waker>>, drop_tx: mpsc::Sender<()>, } impl Future for MyTask { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> { if let Some(tx) = self.get_mut().task_tx.take() { tx.send(...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:4
// Ensure `task` lives until after the test completes. drop(task); } #[test] fn park_called_at_interval() { struct MyPark { park_light: Arc<AtomicBool>, } struct MyUnpark {} impl Park for MyPark { type Unpark = MyUnpark; type Error = (); fn unpark(&self) -> Self::...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/pool.rs:5
fn unpark(&self) {} } let park_light_1 = Arc::new(AtomicBool::new(false)); let park_light_2 = park_light_1.clone(); let (done_tx, done_rx) = mpsc::channel(); let pool = ThreadPool::new( 1, blocking::Pool::new("test".into(), None), Arc::new(Box::new(|_, next| next())), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/pool.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/pool.rs
161
201
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:1
use crate::runtime::thread_pool::{queue, LOCAL_QUEUE_CAPACITY}; use crate::task::{self, Task}; use crate::tests::mock_schedule::{Noop, NOOP_SCHEDULE}; macro_rules! assert_pop { ($q:expr, $expect:expr) => { assert_eq!( match $q.pop_local_first() { Some(v) => num(v), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:2
macro_rules! assert_empty { ($q:expr) => {{ let q: &mut queue::Worker<Noop> = &mut $q; if let Some(v) = q.pop_local_first() { panic!("expected emtpy queue; got {}", num(v)); } }}; } #[test] fn single_worker_push_pop() { let mut q = queue::build(1).remove(0); // Queu...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:3
assert_empty!(q2); // Push a value q1.push(val(0)); // Not available on other queue assert_empty!(q2); assert_pop!(q1, 0); q2.push(val(1)); assert_pop!(q2, 1); assert_empty!(q1); } #[test] fn multi_worker_inject_pop() { let (mut q1, mut q2) = queues_2(); let i = q1.injector()...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:4
for i in 0..LOCAL_QUEUE_CAPACITY { q1.push(val(i as u32)); } assert_empty!(q2); // Fill `next` slot q1.push(val(999)); // overflow q1.push(val(1000)); assert_pop!(q2, 0); assert_pop!(q1, 1000); // Half the values were moved to the global queue for i in 128..LOCAL_QUE...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:5
q.push(val(n)); } assert_pop_global!(q, 1000); assert_pop!(q, 4); assert_pop_global!(q, 1001); assert_pop_global!(q, 0); assert_pop!(q, 1); assert_pop_global!(q, 2); assert_pop_global!(q, 3); assert!(q.pop_global_first().is_none()); } #[test] fn steal() { let mut qs = queue::b...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:6
assert_pop!(q1, 999); assert_pop!(q1, 2); assert_pop!(q1, 3); assert_empty!(q1); // Searches multiple queues q3.push(val(0)); q3.push(val(999)); assert_steal!(q2, 0, 0); assert_pop!(q3, 999); assert_empty!(q3); // Steals from one queue at a time q1.push(val(0)); q1.push...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:7
let (task, join) = task::joinable(async move { num }); let prev = TASKS.with(|t| t.borrow_mut().insert(num, join)); assert!(prev.is_none()); task } fn num(task: Task<Noop>) -> u32 { use futures::task::noop_waker_ref; use std::future::Future; use std::pin::Pin; use std::task::Context; us...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/thread_pool/tests/queue.rs
241
277
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:1
use crate::runtime::thread_pool::{queue, LOCAL_QUEUE_CAPACITY}; use crate::task::{self, Task}; use crate::tests::mock_schedule::{Noop, NOOP_SCHEDULE}; macro_rules! assert_pop { ($q:expr, $expect:expr) => { assert_eq!( match $q.pop_local_first() { Some(v) => num(v), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:2
macro_rules! assert_empty { ($q:expr) => {{ let q: &mut queue::Worker<Noop> = &mut $q; match q.pop_local_first() { Some(v) => panic!("expected emtpy queue; got {}", num(v)), None => {} } }}; } #[test] fn single_worker_push_pop() { let mut q = queue::build(1)....
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:3
assert_empty!(q1); assert_empty!(q2); // Push a value q1.push(val(0)); // Not available on other queue assert_empty!(q2); assert_pop!(q1, 0); q2.push(val(1)); assert_pop!(q2, 1); assert_empty!(q1); } #[test] fn multi_worker_inject_pop() { let (mut q1, mut q2) = queues_2(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:4
let (mut q1, mut q2) = queues_2(); for i in 0..LOCAL_QUEUE_CAPACITY { q1.push(val(i as u32)); } assert_empty!(q2); // Fill `next` slot q1.push(val(999)); // overflow q1.push(val(1000)); assert_pop!(q2, 0); assert_pop!(q1, 1000); // Half the values were moved to the ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:5
for n in 0..5 { q.push(val(n)); } assert_pop_global!(q, 1000); assert_pop!(q, 4); assert_pop_global!(q, 1001); assert_pop_global!(q, 0); assert_pop!(q, 1); assert_pop_global!(q, 2); assert_pop_global!(q, 3); assert!(q.pop_global_first().is_none()); } #[test] fn steal() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:6
assert_empty!(q2); assert_pop!(q1, 999); assert_pop!(q1, 2); assert_pop!(q1, 3); assert_empty!(q1); // Searches multiple queues q3.push(val(0)); q3.push(val(999)); assert_steal!(q2, 0, 0); assert_pop!(q3, 999); assert_empty!(q3); // Steals from one queue at a time q1.pu...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:7
fn val(num: u32) -> Task<Noop> { let (task, join) = task::joinable(async move { num }); let prev = TASKS.with(|t| t.borrow_mut().insert(num, join)); assert!(prev.is_none()); task } fn num(task: Task<Noop>) -> u32 { use futures::task::noop_waker_ref; use std::future::Future; use std::pin::Pi...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/runtime/thread_pool/tests/queue.rs
241
281
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:6
assert_empty!(q2); assert_pop!(q1, 999); assert_pop!(q1, 2); assert_pop!(q1, 3); assert_empty!(q1); // Searches multiple queues q3.push(val(0)); q3.push(val(999)); assert_steal!(q2, 0, 0); assert_pop!(q3, 999); assert_empty!(q3); // Steals from one queue at a time q1.pu...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/queue.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/queue.rs:7
fn val(num: u32) -> Task<Noop> { let (task, join) = task::joinable(async move { num }); let prev = TASKS.with(|t| t.borrow_mut().insert(num, join)); assert!(prev.is_none()); task } fn num(task: Task<Noop>) -> u32 { use futures_util::task::noop_waker_ref; use std::future::Future; use std::pi...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/queue.rs
MIT
27e5b41067d01c0c9fac230c5addb58034201a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/thread_pool/tests/queue.rs
241
281
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/worker.rs:1
use crate::runtime::blocking; use crate::runtime::tests::track_drop::track_drop; use crate::runtime::thread_pool; use tokio_test::assert_ok; use std::sync::Arc; macro_rules! pool { (2) => {{ let (pool, mut w, mock_park) = pool!(!2); (pool, w.remove(0), w.remove(0), mock_park) }}; (! $n:ex...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/worker.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/worker.rs
1
60
tokio-rs/tokio:tokio/src/runtime/thread_pool/tests/worker.rs:2
enter!(w0, p.spawn_background(async move { tx.send(1).unwrap() })); w0.tick(); assert_ok!(rx.try_recv()); } #[test] fn task_migrates() { use crate::sync::oneshot; use std::sync::mpsc; let (p, mut w0, mut w1, ..) = pool!(2); let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = mpsc::chan...
rust
rust
testsuite
tokio-rs/tokio
tokio/src/runtime/thread_pool/tests/worker.rs
MIT
4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dbe6af0a1a1c8e579b92ec8ffc1d419244e0944/tokio/src/runtime/thread_pool/tests/worker.rs
41
77
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:2
//! inject queue. //! //! The first case can only happen if the OwnedTasks::bind call happens before //! or during step 1 of shutdown. In this case, the runtime will clean up the //! task in step 3 of shutdown. //! //! In the latter case, the task was not spawned and the task is immediately //! cancelled by the spaw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
41
100
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:3
index: usize, /// Used to hand-off a worker's core to another thread. core: AtomicCell<Core>, } /// Core data struct Core { /// Used to schedule bookkeeping tasks every so often. tick: u32, /// When a task is scheduled from a worker, it is stored in this slot. The /// worker will check this s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
81
140
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:4
/// State shared across all workers pub(super) struct Shared { /// Handle to the I/O driver, timer, blocking spawner, ... handle_inner: HandleInner, /// Per-worker remote state. All other workers have access to this and is /// how they communicate between each other. remotes: Box<[Remote]>, //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
121
180
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:5
steal: queue::Steal<Arc<Shared>>, /// Unparks the associated worker thread unpark: Unparker, } /// Thread-local context struct Context { /// Worker worker: Arc<Worker>, /// Core data core: RefCell<Option<Box<Core>>>, } /// Starts the workers pub(crate) struct Launch(Vec<Arc<Worker>>); /// R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
161
220
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:6
let mut worker_metrics = Vec::with_capacity(size); // Create the local queues for _ in 0..size { let (steal, run_queue) = queue::local(); let park = park.clone(); let unpark = park.unpark(); cores.push(Box::new(Core { tick: 0, lifo_slot: None, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
201
260
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:7
shared: shared.clone(), index, core: AtomicCell::new(Some(core)), })); } (shared, launch) } pub(crate) fn block_in_place<F, R>(f: F) -> R where F: FnOnce() -> R, { // Try to steal the worker core back struct Reset(coop::Budget); impl Drop for Reset { fn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
241
300
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:8
had_entered = true; } (EnterContext::Entered { allow_blocking }, false) => { // We are on an executor, but _not_ on the thread pool. That is // _only_ okay if we are in a thread pool runtime's block_on // method: if allow_blocking ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
281
340
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:9
// // First, move the core back into the worker's shared core slot. cx.worker.core.set(core); // Next, clone the worker handle and send it to a new thread for // processing. // // Once the blocking task is done executing, we will attempt to // steal the core back...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
321
380
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:10
// Set the worker context. let cx = Context { worker, core: RefCell::new(None), }; let _enter = crate::runtime::enter(true); CURRENT.set(&cx, || { // This should always be an error. It only returns a `Result` to support // using `?` to short circuit. assert!(cx....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
361
420
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:11
core.pre_shutdown(&self.worker); // Signal shutdown self.worker.shared.shutdown(core); Err(()) } fn run_task(&self, task: Notified, mut core: Box<Core>) -> RunResult { let task = self.worker.shared.owned.assert_owner(task); // Make sure the worker is not in the **searc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
401
460
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:12
core.metrics.incr_poll_count(); *self.core.borrow_mut() = Some(core); let task = self.worker.shared.owned.assert_owner(task); task.run(); } else { // Not enough budget left to run the LIFO task, push it to ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
441
500
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:13
if let Some(f) = &self.worker.shared.config.before_park { f(); } if core.transition_to_parked(&self.worker) { while !core.is_shutdown { core.metrics.about_to_park(); core = self.park_timeout(core, None); core.metrics.returned_from_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
481
540
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:14
core = self.core.borrow_mut().take().expect("core missing"); // Place `park` back in `core` core.park = Some(park); // If there are tasks available to steal, but this worker is not // looking for tasks to steal, notify another worker. if !core.is_searching && core.run_queue.is_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
521
580
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:15
if !self.transition_to_searching(worker) { return None; } let num = worker.shared.remotes.len(); // Start from a random worker let start = self.rand.fastrand_n(num as u32) as usize; for i in 0..num { let i = (start + i) % num; // Don't steal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
561
620
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:16
} self.is_searching = false; worker.shared.transition_worker_from_searching(); } /// Prepares the worker state for parking. /// /// Returns true if the transition happened, false if there is work to do first. fn transition_to_parked(&mut self, worker: &Worker) -> bool { // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
601
660
tokio-rs/tokio:tokio/src/runtime/thread_pool/worker.rs:17
// state when the wake originates from another worker *or* a new task // is pushed. We do *not* want the worker to transition to "searching" // when it wakes when the I/O driver receives new events. self.is_searching = !worker.shared.idle.unpark_worker_by_id(worker.index); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/thread_pool/worker.rs
MIT
b023522a37a48d16de02e654b6c88ffe1eccb280
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b023522a37a48d16de02e654b6c88ffe1eccb280/tokio/src/runtime/thread_pool/worker.rs
641
700