move the definition of thread priorities to hermit-abi

This commit is contained in:
Stefan Lankes 2020-03-30 07:37:52 +02:00
parent 6c80bdb388
commit 9f6b96e461
3 changed files with 4 additions and 27 deletions

View File

@ -1372,9 +1372,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.1.9"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ebe6e23502442c4c9cd80fcb8bdf867dc5f4a9e9f1d882499fa49c5ed83e559"
checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e"
dependencies = [
"compiler_builtins",
"libc",

View File

@ -41,7 +41,7 @@ dlmalloc = { version = "0.1", features = ['rustc-dep-of-std'] }
fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies]
hermit-abi = { version = "0.1.9", features = ['rustc-dep-of-std'] }
hermit-abi = { version = "0.1.10", features = ['rustc-dep-of-std'] }
[target.wasm32-wasi.dependencies]
wasi = { version = "0.9.0", features = ['rustc-dep-of-std'], default-features = false }

View File

@ -1,7 +1,6 @@
#![allow(dead_code)]
use crate::ffi::CStr;
use crate::fmt;
use crate::io;
use crate::mem;
use crate::sys::hermit::abi;
@ -12,28 +11,6 @@ use crate::sys_common::thread::*;
pub type Tid = abi::Tid;
/// Priority of a task
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)]
pub struct Priority(u8);
impl Priority {
pub const fn into(self) -> u8 {
self.0
}
pub const fn from(x: u8) -> Self {
Priority(x)
}
}
impl fmt::Display for Priority {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
pub const NORMAL_PRIO: Priority = Priority::from(2);
pub struct Thread {
tid: Tid,
}
@ -55,7 +32,7 @@ impl Thread {
&mut tid as *mut Tid,
thread_start,
&*p as *const _ as *const u8 as usize,
Priority::into(NORMAL_PRIO),
abi::Priority::into(abi::NORMAL_PRIO),
core_id,
);