mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
kernel: services: remember new thread if specified
If we switch to a thread and specify a thread ID, remember that as the current thread ID. This prevents thread starvation by repeatedly going back to the same thread ID. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
9ab5b4880f
commit
00e7f07187
1 changed files with 3 additions and 1 deletions
|
|
@ -854,13 +854,15 @@ impl SystemServices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new.current_thread = new_tid as _;
|
new.current_thread = new_tid as _;
|
||||||
// println!(" -- picked thread {}", new_tid);
|
klog!("picked thread ID {}", new_tid);
|
||||||
} else if x & (1 << new_tid) == 0 {
|
} else if x & (1 << new_tid) == 0 {
|
||||||
// println!(
|
// println!(
|
||||||
// "thread is {:?}, which is not valid for new thread {}",
|
// "thread is {:?}, which is not valid for new thread {}",
|
||||||
// new.state, new_tid
|
// new.state, new_tid
|
||||||
// );
|
// );
|
||||||
return Err(xous_kernel::Error::ProcessNotFound);
|
return Err(xous_kernel::Error::ProcessNotFound);
|
||||||
|
} else {
|
||||||
|
new.current_thread = new_tid as _;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProcessState::Sleeping => {
|
ProcessState::Sleeping => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue