From 4b15dd5a84742f9e7641b62e490765e0c1cb415c Mon Sep 17 00:00:00 2001 From: joboet Date: Fri, 29 Aug 2025 18:01:02 +0200 Subject: std: move `thread` into `sys` (rename only) --- library/std/src/sys/thread/unsupported.rs | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 library/std/src/sys/thread/unsupported.rs (limited to 'library/std/src/sys/thread/unsupported.rs') diff --git a/library/std/src/sys/thread/unsupported.rs b/library/std/src/sys/thread/unsupported.rs new file mode 100644 index 00000000000..34d9b5ec70c --- /dev/null +++ b/library/std/src/sys/thread/unsupported.rs @@ -0,0 +1,48 @@ +use super::unsupported; +use crate::ffi::CStr; +use crate::io; +use crate::num::NonZero; +use crate::time::{Duration, Instant}; + +pub struct Thread(!); + +pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024; + +impl Thread { + // unsafe: see thread::Builder::spawn_unchecked for safety requirements + pub unsafe fn new( + _stack: usize, + _name: Option<&str>, + _p: Box, + ) -> io::Result { + unsupported() + } + + pub fn yield_now() { + // do nothing + } + + pub fn set_name(_name: &CStr) { + // nope + } + + pub fn sleep(_dur: Duration) { + panic!("can't sleep"); + } + + pub fn sleep_until(_deadline: Instant) { + panic!("can't sleep"); + } + + pub fn join(self) { + self.0 + } +} + +pub(crate) fn current_os_id() -> Option { + None +} + +pub fn available_parallelism() -> io::Result> { + unsupported() +} -- cgit 1.4.1-3-g733a5