Skip to main content

std/sys/thread/
unsupported.rs

1use crate::ffi::CStr;
2use crate::io;
3use crate::num::NonZero;
4use crate::thread::ThreadInit;
5use crate::time::Duration;
6
7// Silence dead code warnings for the otherwise unused ThreadInit::init() call.
8#[expect(dead_code)]
9fn dummy_init_call(init: Box<ThreadInit>) {
10    drop(init.init());
11}
12
13pub struct Thread(!);
14
15pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024;
16
17impl Thread {
18    // unsafe: see thread::Builder::spawn_unchecked for safety requirements
19    pub unsafe fn new(_stack: usize, _init: Box<ThreadInit>) -> io::Result<Thread> {
20        Err(io::Error::UNSUPPORTED_PLATFORM)
21    }
22
23    pub fn join(self) {
24        self.0
25    }
26}
27
28pub fn available_parallelism() -> io::Result<NonZero<usize>> {
29    Err(io::Error::UNKNOWN_THREAD_COUNT)
30}
31
32pub fn current_os_id() -> Option<u64> {
33    None
34}
35
36pub fn yield_now() {
37    // do nothing
38}
39
40pub fn set_name(_name: &CStr) {
41    // nope
42}
43
44pub fn sleep(_dur: Duration) {
45    panic!("can't sleep");
46}