Add get_name placeholder to other targets

This commit is contained in:
Chris Denton 2024-03-01 16:38:02 -03:00
parent c84ba23062
commit 6cb0c404b3
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
8 changed files with 40 additions and 8 deletions

View file

@ -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<CString> {
None
}
#[inline]
pub fn sleep(dur: Duration) {
unsafe {

View file

@ -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<CString> {
None
}
pub fn sleep(dur: Duration) {
for timeout in dur2reltims(dur) {
expect_success(unsafe { abi::dly_tsk(timeout) }, &"dly_tsk");

View file

@ -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<CString> {
None
}
pub fn sleep(dur: Duration) {
usercalls::wait_timeout(0, dur, || true);
}

View file

@ -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<CString> {
None
}
/// only main thread could wait for sometime in teeos
pub fn sleep(dur: Duration) {
let sleep_millis = dur.as_millis();

View file

@ -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<CString> {
None
}
pub fn sleep(dur: Duration) {
let boot_services: NonNull<r_efi::efi::BootServices> =
crate::os::uefi::env::boot_services().expect("can't sleep").cast();

View file

@ -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<CString> {
None
}
pub fn sleep(_dur: Duration) {
panic!("can't sleep");
}

View file

@ -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<CString> {
None
}
pub fn sleep(dur: Duration) {
let nanos = dur.as_nanos();
assert!(nanos <= u64::MAX as u128);

View file

@ -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<CString> {
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