mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
xous: fix blocking return values
These values weren't being properly returned when Yielding or when calling operations that would block, or that actually blocked. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5f52acfa9b
commit
b24719a0fc
1 changed files with 16 additions and 11 deletions
|
|
@ -455,7 +455,7 @@ pub fn _xous_syscall(
|
||||||
&mut xsc_asmut.send.lock().unwrap(),
|
&mut xsc_asmut.send.lock().unwrap(),
|
||||||
);
|
);
|
||||||
_xous_syscall_result(ret, *tid.borrow(), xsc_asmut);
|
_xous_syscall_result(ret, *tid.borrow(), xsc_asmut);
|
||||||
if *ret != Result::WouldBlock {
|
if *ret != Result::BlockedProcess {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
|
|
@ -530,23 +530,27 @@ fn _xous_syscall_result(ret: &mut Result, thread_id: TID, server_connection: &Se
|
||||||
*pkt_word = usize::from_le_bytes(word.try_into().unwrap());
|
*pkt_word = usize::from_le_bytes(word.try_into().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if this thread will have a memory packet following it.
|
|
||||||
let call = CALL_FOR_THREAD.with(|cft| {
|
|
||||||
cft.borrow()
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.remove(&msg_thread_id)
|
|
||||||
.expect("thread didn't declare whether it has data")
|
|
||||||
});
|
|
||||||
|
|
||||||
let mut response = Result::from_args(pkt);
|
let mut response = Result::from_args(pkt);
|
||||||
|
|
||||||
// println!(" Response to {:?}: {:?}", call, response);
|
// println!(" Response to {:?}: {:?}", call, response);
|
||||||
if Result::BlockedProcess == response {
|
if (Result::BlockedProcess == response) || (Result::WouldBlock == response) {
|
||||||
// println!(" Waiting again");
|
// println!(" Waiting again");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if this thread will have a memory packet following it.
|
||||||
|
let call = CALL_FOR_THREAD.with(|cft| {
|
||||||
|
let cft_borrowed = cft.borrow();
|
||||||
|
let mut cft_mtx = cft_borrowed.lock().unwrap();
|
||||||
|
if ! cft_mtx.contains_key(&msg_thread_id) {
|
||||||
|
eprintln!("msg_thd_id: {} cft: {:?}", msg_thread_id, cft_mtx);
|
||||||
|
::debug_here::debug_here!();
|
||||||
|
}
|
||||||
|
cft_mtx
|
||||||
|
.remove(&msg_thread_id)
|
||||||
|
.expect("thread didn't declare whether it has data")
|
||||||
|
});
|
||||||
|
|
||||||
// If the client is passing us memory, remap the array to our own space.
|
// If the client is passing us memory, remap the array to our own space.
|
||||||
if let Result::Message(msg) = &mut response {
|
if let Result::Message(msg) = &mut response {
|
||||||
match &mut msg.body {
|
match &mut msg.body {
|
||||||
|
|
@ -618,6 +622,7 @@ fn _xous_syscall_result(ret: &mut Result, thread_id: TID, server_connection: &Se
|
||||||
*ret = response;
|
*ret = response;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
eprintln!("msg_thread_id {} != thread_id {}", msg_thread_id, thread_id);
|
||||||
|
|
||||||
// Otherwise, add it to the mailbox and try again.
|
// Otherwise, add it to the mailbox and try again.
|
||||||
let mut mailbox = server_connection.mailbox.lock().unwrap();
|
let mut mailbox = server_connection.mailbox.lock().unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue