Skip to content

Commit 9622cde

Browse files
committed
std: replace generic thread parker with explicit no-op parker
1 parent 4b34c7b commit 9622cde

File tree

6 files changed

+17
-129
lines changed

6 files changed

+17
-129
lines changed

library/std/src/sys/unsupported/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub mod thread;
2222
#[cfg(target_thread_local)]
2323
pub mod thread_local_dtor;
2424
pub mod thread_local_key;
25+
pub mod thread_parking;
2526
pub mod time;
2627

2728
mod common;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use crate::pin::Pin;
2+
use crate::time::Duration;
3+
4+
pub struct Parker {}
5+
6+
impl Parker {
7+
pub unsafe fn new_in_place(_parker: *mut Parker) {}
8+
pub unsafe fn park(self: Pin<&Self>) {}
9+
pub unsafe fn park_timeout(self: Pin<&Self>, _dur: Duration) {}
10+
pub fn unpark(self: Pin<&Self>) {}
11+
}

library/std/src/sys/wasi/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub mod thread;
4949
pub mod thread_local_dtor;
5050
#[path = "../unsupported/thread_local_key.rs"]
5151
pub mod thread_local_key;
52+
#[path = "../unsupported/thread_parking.rs"]
53+
pub mod thread_parking;
5254
pub mod time;
5355

5456
#[path = "../unsupported/common.rs"]

library/std/src/sys/wasm/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ cfg_if::cfg_if! {
7070
pub mod once;
7171
#[path = "../unsupported/thread.rs"]
7272
pub mod thread;
73+
#[path = "../unsupported/thread_parking.rs"]
74+
pub mod thread_parking;
7375
}
7476
}
7577

library/std/src/sys_common/thread_parking/generic.rs

-125
This file was deleted.

library/std/src/sys_common/thread_parking/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ cfg_if::cfg_if! {
1818
))] {
1919
mod id;
2020
pub use id::Parker;
21-
} else if #[cfg(any(windows, target_family = "unix"))] {
22-
pub use crate::sys::thread_parking::Parker;
2321
} else {
24-
mod generic;
25-
pub use generic::Parker;
22+
pub use crate::sys::thread_parking::Parker;
2623
}
2724
}

0 commit comments

Comments
 (0)