xous-rs: remove baremetal cfg

We now check if `target_os = "none"`.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-08-14 19:53:33 +08:00
parent 89d6259819
commit f469bfcffc
4 changed files with 9 additions and 15 deletions

View file

@ -28,13 +28,11 @@ pub struct ProcessInit {
pub key: ProcessKey,
}
#[cfg(not(baremetal))]
pub struct ProcessArgsAsThread<F: FnOnce()> {
main: F,
name: String,
}
#[cfg(not(baremetal))]
impl<F> ProcessArgsAsThread<F>
where
F: FnOnce(),
@ -46,12 +44,10 @@ where
}
}
}
#[cfg(not(baremetal))]
pub struct ProcessHandleAsThread(std::thread::JoinHandle<()>);
/// If no connection exists, create a new connection to the server. This means
/// our parent PID will be PID1. Otherwise, reuse the same connection.
#[cfg(not(baremetal))]
pub fn create_process_pre_as_thread<F>(
_args: &ProcessArgsAsThread<F>,
) -> core::result::Result<ProcessInit, crate::Error>
@ -70,7 +66,6 @@ where
})
}
#[cfg(not(baremetal))]
pub fn create_process_post_as_thread<F>(
args: ProcessArgsAsThread<F>,
init: ProcessInit,
@ -109,7 +104,6 @@ where
Ok(ProcessHandleAsThread(thread_main.0))
}
#[cfg(not(baremetal))]
pub fn wait_process_as_thread(joiner: ProcessHandleAsThread) -> crate::SysCallResult {
joiner.0.join().map(|_| Result::Ok).map_err(|_x| {
// panic!("wait error: {:?}", x);

View file

@ -1,9 +1,9 @@
#[cfg(baremetal)]
#[cfg(target_os = "none")]
pub mod native;
#[cfg(baremetal)]
#[cfg(target_os = "none")]
pub use native::*;
#[cfg(any(windows,unix))]
#[cfg(not(target_os = "none"))]
pub mod hosted;
#[cfg(any(windows,unix))]
#[cfg(not(target_os = "none"))]
pub use hosted::*;

View file

@ -1,4 +1,4 @@
#![cfg_attr(baremetal, no_std)]
#![cfg_attr(target_os = "none", no_std)]
#[macro_use]
extern crate bitflags;
@ -19,7 +19,7 @@ pub use definitions::*;
pub use messages::*;
pub use syscall::*;
#[cfg(not(baremetal))]
#[cfg(not(target_os = "none"))]
pub use arch::ProcessArgsAsThread;
/// Convert a four-letter string into a 32-bit int.

View file

@ -6,7 +6,7 @@ use crate::{
// use num_derive::FromPrimitive;
// use num_traits::FromPrimitive;
#[cfg(not(baremetal))]
#[cfg(not(target_os = "none"))]
use crate::ProcessArgsAsThread;
#[derive(Debug, PartialEq)]
@ -888,7 +888,7 @@ pub fn wait_thread<T>(joiner: crate::arch::WaitHandle<T>) -> SysCallResult {
}
/// Create a new process by running it in its own thread
#[cfg(not(baremetal))]
#[cfg(not(target_os = "none"))]
pub fn create_process_as_thread<F>(
args: ProcessArgsAsThread<F>,
) -> core::result::Result<crate::arch::ProcessHandleAsThread, Error>
@ -906,7 +906,7 @@ where
}
/// Wait for a thread to finish
#[cfg(not(baremetal))]
#[cfg(not(target_os = "none"))]
pub fn wait_process_as_thread(joiner: crate::arch::ProcessHandleAsThread) -> SysCallResult {
crate::arch::wait_process_as_thread(joiner)
}