| 1 | use crate::ffi::CStr; |
| 2 | use crate::io; |
| 3 | use crate::num::NonZero; |
| 4 | use crate::thread::ThreadInit; |
| 5 | use crate::time::Duration; |
| 6 | |
| 7 | // Silence dead code warnings for the otherwise unused ThreadInit::init() call. |
| 8 | #[expect (dead_code)] |
| 9 | fn dummy_init_call(init: Box<ThreadInit>) { |
| 10 | drop(init.init()); |
| 11 | } |
| 12 | |
| 13 | pub struct Thread(!); |
| 14 | |
| 15 | pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024; |
| 16 | |
| 17 | impl 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 | |
| 28 | pub fn available_parallelism() -> io::Result<NonZero<usize>> { |
| 29 | Err(io::Error::UNKNOWN_THREAD_COUNT) |
| 30 | } |
| 31 | |
| 32 | pub fn current_os_id() -> Option<u64> { |
| 33 | None |
| 34 | } |
| 35 | |
| 36 | pub fn yield_now() { |
| 37 | // do nothing |
| 38 | } |
| 39 | |
| 40 | pub fn set_name(_name: &CStr) { |
| 41 | // nope |
| 42 | } |
| 43 | |
| 44 | pub fn sleep(_dur: Duration) { |
| 45 | panic!("can't sleep" ); |
| 46 | } |
| 47 | |