PUS Event Manager #19
@ -42,6 +42,7 @@ fn test_threaded_usage() {
|
|||||||
// PUS + Generic event manager thread
|
// PUS + Generic event manager thread
|
||||||
let jh0 = thread::spawn(move || {
|
let jh0 = thread::spawn(move || {
|
||||||
let mut sender = EventTmSender { sender: event_tx };
|
let mut sender = EventTmSender { sender: event_tx };
|
||||||
|
let mut event_cnt = 0;
|
||||||
loop {
|
loop {
|
||||||
let res = event_man.try_event_handling();
|
let res = event_man.try_event_handling();
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
@ -61,10 +62,13 @@ fn test_threaded_usage() {
|
|||||||
event,
|
event,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
event_cnt += 1;
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
assert!(res.unwrap());
|
assert!(res.unwrap());
|
||||||
|
if event_cnt == 2 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if let TryRecvError::Disconnected = e {
|
if let TryRecvError::Disconnected = e {
|
||||||
panic!("Event receiver disconnected!")
|
panic!("Event receiver disconnected!")
|
||||||
@ -82,7 +86,10 @@ fn test_threaded_usage() {
|
|||||||
loop {
|
loop {
|
||||||
match event_rx.try_recv() {
|
match event_rx.try_recv() {
|
||||||
// Event TM received successfully
|
// Event TM received successfully
|
||||||
Ok(_) => break,
|
Ok(event) => {
|
||||||
|
println!("{:x?}", event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if let TryRecvError::Disconnected = e {
|
if let TryRecvError::Disconnected = e {
|
||||||
panic!("Event sender disconnected!")
|
panic!("Event sender disconnected!")
|
||||||
@ -99,7 +106,10 @@ fn test_threaded_usage() {
|
|||||||
loop {
|
loop {
|
||||||
match event_rx.try_recv() {
|
match event_rx.try_recv() {
|
||||||
// Event TM received successfully
|
// Event TM received successfully
|
||||||
Ok(_) => break,
|
Ok(event) => {
|
||||||
|
println!("{:x?}", event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if let TryRecvError::Disconnected = e {
|
if let TryRecvError::Disconnected = e {
|
||||||
panic!("Event sender disconnected!")
|
panic!("Event sender disconnected!")
|
||||||
|
Loading…
Reference in New Issue
Block a user