mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
Merge pull request #175 from kelas/main
don't block if the queue isn't empty
This commit is contained in:
commit
9acb8b8ac5
1 changed files with 11 additions and 0 deletions
|
|
@ -790,6 +790,17 @@ fn main() -> ! {
|
|||
if ena != 0 { vibe = true }
|
||||
else { vibe = false }
|
||||
}),
|
||||
Some(Opcode::BlockingKeyListener) => {
|
||||
if blocking_queue.len() != 0 {
|
||||
// we have a pending byte in the queue, return it
|
||||
let k_prime = blocking_queue.pop_front().unwrap();
|
||||
xous::return_scalar2(msg.sender, k_prime, 0).unwrap();
|
||||
} else {
|
||||
// by simply storing the sender address and not returning a value,
|
||||
// the sender will remain blocked until the return value is generated
|
||||
blocking_listener.push(msg.sender);
|
||||
}
|
||||
},
|
||||
Some(Opcode::BlockingKeyListener) => {
|
||||
// by simply storing the sender address and not returning a value,
|
||||
// the sender will remain blocked until the return value is generated
|
||||
|
|
|
|||
Loading…
Reference in a new issue