quit the ec updater thread once we're done checking for updates

unless we're debugging, there is no more need for its resources
to be allocated.
This commit is contained in:
bunnie 2022-07-11 16:23:36 +08:00
parent 7248f47ca8
commit 3e8065ee56
2 changed files with 8 additions and 0 deletions

View file

@ -340,6 +340,7 @@ pub(crate) fn ecupdate_thread(sid: xous::SID) {
},
Some(UpdateOp::Quit) => {
log::info!("quitting updater thread");
xous::return_scalar(msg.sender, 1).unwrap();
break;
},
None => {

View file

@ -323,6 +323,13 @@ fn wrapped_main() -> ! {
}
_ => log::error!("Invalid return type from UpdateAuto"),
}
#[cfg(not(feature="dbg-ecupdate"))]
{ // if we're not debugging, quit the updater thread -- might as well free up the memory and connections if nobody will ever use it again.
send_message(ecup_conn,
Message::new_blocking_scalar(ecup::UpdateOp::Quit.to_usize().unwrap(), 0, 0, 0, 0)
).expect("couldn't quit updater thread");
unsafe{xous::disconnect(ecup_conn).ok()};
}
let keys = Arc::new(Mutex::new(
root_keys::RootKeys::new(&xns, None)