diff --git a/library/std/src/sys/pal/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs index fee80c02d4a..cf45b9c2396 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -2,7 +2,7 @@ use super::abi; use super::thread_local_dtor::run_dtors; -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::mem; use crate::num::NonZero; @@ -71,6 +71,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + #[inline] pub fn sleep(dur: Duration) { unsafe { diff --git a/library/std/src/sys/pal/itron/thread.rs b/library/std/src/sys/pal/itron/thread.rs index 9c1387bf408..814a102dd09 100644 --- a/library/std/src/sys/pal/itron/thread.rs +++ b/library/std/src/sys/pal/itron/thread.rs @@ -8,7 +8,7 @@ use super::{ }; use crate::{ cell::UnsafeCell, - ffi::CStr, + ffi::{CStr, CString}, hint, io, mem::ManuallyDrop, num::NonZero, @@ -204,6 +204,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + pub fn sleep(dur: Duration) { for timeout in dur2reltims(dur) { expect_success(unsafe { abi::dly_tsk(timeout) }, &"dly_tsk"); diff --git a/library/std/src/sys/pal/sgx/thread.rs b/library/std/src/sys/pal/sgx/thread.rs index c797fde7fbd..77f68bf7334 100644 --- a/library/std/src/sys/pal/sgx/thread.rs +++ b/library/std/src/sys/pal/sgx/thread.rs @@ -1,6 +1,6 @@ #![cfg_attr(test, allow(dead_code))] // why is this necessary? use super::unsupported; -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::num::NonZero; use crate::time::Duration; @@ -133,6 +133,10 @@ impl Thread { // which succeeds as-is with the SGX target. } + pub fn get_name() -> Option { + None + } + pub fn sleep(dur: Duration) { usercalls::wait_timeout(0, dur, || true); } diff --git a/library/std/src/sys/pal/teeos/thread.rs b/library/std/src/sys/pal/teeos/thread.rs index 77f9040ead5..b76bcf9bbb0 100644 --- a/library/std/src/sys/pal/teeos/thread.rs +++ b/library/std/src/sys/pal/teeos/thread.rs @@ -1,7 +1,7 @@ use core::convert::TryInto; use crate::cmp; -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::mem; use crate::num::NonZero; @@ -101,6 +101,10 @@ impl Thread { // contact the teeos rustzone team. } + pub fn get_name() -> Option { + None + } + /// only main thread could wait for sometime in teeos pub fn sleep(dur: Duration) { let sleep_millis = dur.as_millis(); diff --git a/library/std/src/sys/pal/uefi/thread.rs b/library/std/src/sys/pal/uefi/thread.rs index 3d8fa27251f..b3a4f9c53e3 100644 --- a/library/std/src/sys/pal/uefi/thread.rs +++ b/library/std/src/sys/pal/uefi/thread.rs @@ -1,5 +1,5 @@ use super::unsupported; -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::num::NonZero; use crate::ptr::NonNull; @@ -23,6 +23,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + pub fn sleep(dur: Duration) { let boot_services: NonNull = crate::os::uefi::env::boot_services().expect("can't sleep").cast(); diff --git a/library/std/src/sys/pal/unsupported/thread.rs b/library/std/src/sys/pal/unsupported/thread.rs index cd1ae7f7d11..b3a91ee1d4c 100644 --- a/library/std/src/sys/pal/unsupported/thread.rs +++ b/library/std/src/sys/pal/unsupported/thread.rs @@ -1,5 +1,5 @@ use super::unsupported; -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::num::NonZero; use crate::time::Duration; @@ -22,6 +22,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + pub fn sleep(_dur: Duration) { panic!("can't sleep"); } diff --git a/library/std/src/sys/pal/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs index 77d8b4378e7..4b116052f8f 100644 --- a/library/std/src/sys/pal/wasi/thread.rs +++ b/library/std/src/sys/pal/wasi/thread.rs @@ -1,4 +1,4 @@ -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::mem; use crate::num::NonZero; @@ -134,6 +134,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + pub fn sleep(dur: Duration) { let nanos = dur.as_nanos(); assert!(nanos <= u64::MAX as u128); diff --git a/library/std/src/sys/pal/xous/thread.rs b/library/std/src/sys/pal/xous/thread.rs index 21f5954d6e2..f95ceb7343b 100644 --- a/library/std/src/sys/pal/xous/thread.rs +++ b/library/std/src/sys/pal/xous/thread.rs @@ -1,4 +1,4 @@ -use crate::ffi::CStr; +use crate::ffi::{CStr, CString}; use crate::io; use crate::num::NonZero; use crate::os::xous::ffi::{ @@ -113,6 +113,10 @@ impl Thread { // nope } + pub fn get_name() -> Option { + None + } + pub fn sleep(dur: Duration) { // Because the sleep server works on units of `usized milliseconds`, split // the messages up into these chunks. This means we may run into issues