Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rt: move park logic into runtime module #5158

Merged
merged 2 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tokio/src/future/block_on.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cfg_rt! {
cfg_not_rt! {
#[track_caller]
pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
let mut park = crate::park::thread::CachedParkThread::new();
let mut park = crate::runtime::park::CachedParkThread::new();
park.block_on(f).unwrap()
}
}
1 change: 0 additions & 1 deletion tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ pub mod io;
pub mod net;

mod loom;
mod park;

cfg_process! {
pub mod process;
Expand Down
37 changes: 0 additions & 37 deletions tokio/src/park/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tokio/src/runtime/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(not(feature = "full"), allow(dead_code))]

use crate::park::thread::{ParkThread, UnparkThread};
use crate::runtime::park::{ParkThread, UnparkThread};

use std::io;
use std::time::Duration;
Expand Down
4 changes: 2 additions & 2 deletions tokio/src/runtime/enter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ cfg_rt! {
where
F: std::future::Future,
{
use crate::park::thread::CachedParkThread;
use crate::runtime::park::CachedParkThread;

let mut park = CachedParkThread::new();
park.block_on(f)
Expand All @@ -160,7 +160,7 @@ cfg_rt! {
where
F: std::future::Future,
{
use crate::park::thread::CachedParkThread;
use crate::runtime::park::CachedParkThread;
use std::task::Context;
use std::task::Poll::Ready;
use std::time::Instant;
Expand Down
2 changes: 2 additions & 0 deletions tokio/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ pub(crate) mod context;

pub(crate) mod coop;

pub(crate) mod park;

mod driver;

pub(crate) mod scheduler;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tokio/src/sync/mpsc/chan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::loom::cell::UnsafeCell;
use crate::loom::future::AtomicWaker;
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use crate::park::thread::CachedParkThread;
use crate::runtime::park::CachedParkThread;
use crate::sync::mpsc::error::TryRecvError;
use crate::sync::mpsc::{bounded, list, unbounded};
use crate::sync::notify::Notify;
Expand Down