mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
kernel: fix multiple contexts test
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
9af0fec049
commit
f925011ea2
2 changed files with 6 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ struct ProcessImpl {
|
||||||
/// This enables the kernel to keep track of threads in the
|
/// This enables the kernel to keep track of threads in the
|
||||||
/// target process, and know which threads are ready to
|
/// target process, and know which threads are ready to
|
||||||
/// receive messages.
|
/// receive messages.
|
||||||
threads: [Thread; MAX_THREAD],
|
threads: [Thread; MAX_THREAD + 1],
|
||||||
|
|
||||||
/// The currently-active thread for this process
|
/// The currently-active thread for this process
|
||||||
current_thread: TID,
|
current_thread: TID,
|
||||||
|
|
@ -151,9 +151,9 @@ impl Process {
|
||||||
|
|
||||||
pub fn setup_thread(&mut self, thread: TID, _setup: ThreadInit) -> Result<(), xous::Error> {
|
pub fn setup_thread(&mut self, thread: TID, _setup: ThreadInit) -> Result<(), xous::Error> {
|
||||||
// println!(
|
// println!(
|
||||||
// "KERNEL({}): Setting up context {} @ {:?}",
|
// "KERNEL({}): Setting up thread {} @ {:?}",
|
||||||
// self.pid,
|
// self.pid,
|
||||||
// context,
|
// thread,
|
||||||
// std::thread::current()
|
// std::thread::current()
|
||||||
// );
|
// );
|
||||||
assert!(thread > 0);
|
assert!(thread > 0);
|
||||||
|
|
@ -206,7 +206,7 @@ impl Process {
|
||||||
let current_pid_idx = process_table.current.get() as usize - 1;
|
let current_pid_idx = process_table.current.get() as usize - 1;
|
||||||
let process = &mut process_table.table[current_pid_idx].as_mut().unwrap();
|
let process = &mut process_table.table[current_pid_idx].as_mut().unwrap();
|
||||||
for (index, thread) in process.threads.iter().enumerate() {
|
for (index, thread) in process.threads.iter().enumerate() {
|
||||||
if index != 0 && !thread.allocated {
|
if !thread.allocated {
|
||||||
return Some(index as TID + 1);
|
return Some(index as TID + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,7 +269,7 @@ impl Process {
|
||||||
key: init_data.key,
|
key: init_data.key,
|
||||||
memory_to_return: None,
|
memory_to_return: None,
|
||||||
current_thread: INITIAL_TID,
|
current_thread: INITIAL_TID,
|
||||||
threads: [Thread { allocated: false }; MAX_THREAD],
|
threads: [Thread { allocated: false }; MAX_THREAD + 1],
|
||||||
};
|
};
|
||||||
|
|
||||||
if pid_idx >= process_table.table.len() {
|
if pid_idx >= process_table.table.len() {
|
||||||
|
|
|
||||||
|
|
@ -486,7 +486,7 @@ fn multiple_contexts() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut server_threads = vec![];
|
let mut server_threads = vec![];
|
||||||
for _ in 0..30 {
|
for _ in 0..crate::arch::process::MAX_THREAD {
|
||||||
server_threads.push(
|
server_threads.push(
|
||||||
xous::create_thread(move || {
|
xous::create_thread(move || {
|
||||||
let msg = xous::receive_message(server).expect("couldn't receive message");
|
let msg = xous::receive_message(server).expect("couldn't receive message");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue