diff options
| author | bors <bors@rust-lang.org> | 2020-04-05 23:08:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-05 23:08:44 +0000 |
| commit | 83f8c02eb92b0dfc46ae27cb71421d7bbcd7f30f (patch) | |
| tree | c0ed3870bb4a69ff85668151be1060c9bbfbce52 /src/libstd/sys/hermit/thread.rs | |
| parent | b543afca9b90ad6e4689b6d613ab51f9d3ba15e7 (diff) | |
| parent | 23acf87fa0b1f13d88bd44ca44f4e35a46cc456f (diff) | |
| download | rust-83f8c02eb92b0dfc46ae27cb71421d7bbcd7f30f.tar.gz rust-83f8c02eb92b0dfc46ae27cb71421d7bbcd7f30f.zip | |
Auto merge of #70826 - Centril:rollup-yn0hc1h, r=Centril
Rollup of 7 pull requests
Successful merges:
- #70553 (move OS constants to platform crate)
- #70665 (Do not lose or reorder user-provided linker arguments)
- #70750 (Match options directly in the Fuse implementation)
- #70782 (Stop importing the float modules in documentation)
- #70798 ("cannot resolve" → "cannot satisfy")
- #70808 (Simplify dtor registration for HermitCore by using a list of destructors)
- #70824 (Remove marker comments in libstd/lib.rs macro imports)
Failed merges:
r? @ghost
Diffstat (limited to 'src/libstd/sys/hermit/thread.rs')
| -rw-r--r-- | src/libstd/sys/hermit/thread.rs | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/libstd/sys/hermit/thread.rs b/src/libstd/sys/hermit/thread.rs index 34f88eea0d7..7e3fb4c6d20 100644 --- a/src/libstd/sys/hermit/thread.rs +++ b/src/libstd/sys/hermit/thread.rs @@ -1,36 +1,14 @@ #![allow(dead_code)] use crate::ffi::CStr; -use crate::fmt; use crate::io; use crate::mem; use crate::sys::hermit::abi; +use crate::sys::hermit::fast_thread_local::run_dtors; use crate::time::Duration; 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, } @@ -51,8 +29,8 @@ impl Thread { let ret = abi::spawn( &mut tid as *mut Tid, thread_start, - p as usize, - Priority::into(NORMAL_PRIO), + &*p as *const _ as *const u8 as usize, + abi::Priority::into(abi::NORMAL_PRIO), core_id, ); @@ -69,6 +47,9 @@ impl Thread { unsafe { // Finally, let's run some code. Box::from_raw(main as *mut Box<dyn FnOnce()>)(); + + // run all destructors + run_dtors(); } } } |
