diff options
| author | joboet <jonasboettiger@icloud.com> | 2025-08-29 18:01:02 +0200 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2025-09-08 17:02:25 +0200 |
| commit | 4b15dd5a84742f9e7641b62e490765e0c1cb415c (patch) | |
| tree | 323e992bcaee2813813a29d5d27c9a94304311cd /library/std/src/sys/thread/unsupported.rs | |
| parent | beeb8e3af54295ba494c250e84ecda4c2c5d85ff (diff) | |
| download | rust-4b15dd5a84742f9e7641b62e490765e0c1cb415c.tar.gz rust-4b15dd5a84742f9e7641b62e490765e0c1cb415c.zip | |
std: move `thread` into `sys` (rename only)
Diffstat (limited to 'library/std/src/sys/thread/unsupported.rs')
| -rw-r--r-- | library/std/src/sys/thread/unsupported.rs | 48 |
1 files changed, 48 insertions, 0 deletions
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<dyn FnOnce()>, + ) -> io::Result<Thread> { + 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<u64> { + None +} + +pub fn available_parallelism() -> io::Result<NonZero<usize>> { + unsupported() +} |
