Skip to content

Replace generic thread parker with explicit no-op parker #105695

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

Merged
merged 1 commit into from
May 4, 2023
Merged
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
1 change: 1 addition & 0 deletions library/std/src/sys/unsupported/mod.rs
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ pub mod thread;
#[cfg(target_thread_local)]
pub mod thread_local_dtor;
pub mod thread_local_key;
pub mod thread_parking;
pub mod time;

mod common;
11 changes: 11 additions & 0 deletions library/std/src/sys/unsupported/thread_parking.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::pin::Pin;
use crate::time::Duration;

pub struct Parker {}

impl Parker {
pub unsafe fn new_in_place(_parker: *mut Parker) {}
pub unsafe fn park(self: Pin<&Self>) {}
pub unsafe fn park_timeout(self: Pin<&Self>, _dur: Duration) {}
pub fn unpark(self: Pin<&Self>) {}
}
2 changes: 2 additions & 0 deletions library/std/src/sys/wasi/mod.rs
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@ pub mod thread;
pub mod thread_local_dtor;
#[path = "../unsupported/thread_local_key.rs"]
pub mod thread_local_key;
#[path = "../unsupported/thread_parking.rs"]
pub mod thread_parking;
pub mod time;

#[path = "../unsupported/common.rs"]
2 changes: 2 additions & 0 deletions library/std/src/sys/wasm/mod.rs
Original file line number Diff line number Diff line change
@@ -70,6 +70,8 @@ cfg_if::cfg_if! {
pub mod once;
#[path = "../unsupported/thread.rs"]
pub mod thread;
#[path = "../unsupported/thread_parking.rs"]
pub mod thread_parking;
}
}

125 changes: 0 additions & 125 deletions library/std/src/sys_common/thread_parking/generic.rs

This file was deleted.

5 changes: 1 addition & 4 deletions library/std/src/sys_common/thread_parking/mod.rs
Original file line number Diff line number Diff line change
@@ -18,10 +18,7 @@ cfg_if::cfg_if! {
))] {
mod id;
pub use id::Parker;
} else if #[cfg(any(windows, target_family = "unix"))] {
pub use crate::sys::thread_parking::Parker;
} else {
mod generic;
pub use generic::Parker;
pub use crate::sys::thread_parking::Parker;
}
}