diff options
| author | Tomoaki Kawada <kawada@kmckk.co.jp> | 2022-01-28 17:41:13 +0900 |
|---|---|---|
| committer | Tomoaki Kawada <kawada@kmckk.co.jp> | 2022-01-31 11:31:55 +0900 |
| commit | 09233ce3c0fbcf83abedd7525faa324a2fa2c21c (patch) | |
| tree | 4ecaa5641be52164505b7a4e7f0828a07f188108 /library/std/src | |
| parent | 5ab502c6d308b0ccac8127c0464e432334755a60 (diff) | |
| download | rust-09233ce3c0fbcf83abedd7525faa324a2fa2c21c.tar.gz rust-09233ce3c0fbcf83abedd7525faa324a2fa2c21c.zip | |
kmc-solid: Inherit the calling task's base priority in `Thread::new`
Fixes a spawned task getting an unexpectedly higher priority if it's spawned by a task whose priority is temporarily boosted by a priority- protection mutex.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/itron/thread.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/library/std/src/sys/itron/thread.rs b/library/std/src/sys/itron/thread.rs index ebcc9ab26e0..a8ecc1ada4a 100644 --- a/library/std/src/sys/itron/thread.rs +++ b/library/std/src/sys/itron/thread.rs @@ -84,10 +84,6 @@ impl Thread { /// /// See `thread::Builder::spawn_unchecked` for safety requirements. pub unsafe fn new(stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> { - // Inherit the current task's priority - let current_task = task::try_current_task_id().map_err(|e| e.as_io_error())?; - let priority = task::try_task_priority(current_task).map_err(|e| e.as_io_error())?; - let inner = Box::new(ThreadInner { start: UnsafeCell::new(ManuallyDrop::new(p)), lifecycle: AtomicUsize::new(LIFECYCLE_INIT), @@ -175,7 +171,8 @@ impl Thread { exinf: inner_ptr as abi::EXINF, // The entry point task: Some(trampoline), - itskpri: priority, + // Inherit the calling task's base priority + itskpri: abi::TPRI_SELF, stksz: stack, // Let the kernel allocate the stack, stk: crate::ptr::null_mut(), |
