Skip to content

Commit

Permalink
std: replace generic thread parker with explicit no-op parker
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed Feb 16, 2023
1 parent 4b34c7b commit 9622cde
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 129 deletions.
1 change: 1 addition & 0 deletions library/std/src/sys/unsupported/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
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
Expand Up @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/sys/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
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
Expand Up @@ -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;
}
}

0 comments on commit 9622cde

Please sign in to comment.