1
0
Fork 0

check subkernel exceptions only when awaited

This commit is contained in:
mwojcik 2023-09-06 17:12:11 +08:00
parent 6785ca2c85
commit 779aea7c6a
2 changed files with 0 additions and 50 deletions

View File

@ -187,22 +187,6 @@ async fn handle_run_kernel(
) -> Result<()> { ) -> Result<()> {
control.borrow_mut().tx.async_send(kernel::Message::StartRequest).await; control.borrow_mut().tx.async_send(kernel::Message::StartRequest).await;
loop { loop {
#[cfg(has_drtio)]
while let Some(subkernel_finished) =
subkernel::get_finished_with_exception(aux_mutex, routing_table, timer).await?
{
if subkernel_finished.status == subkernel::FinishStatus::CommLost {
error!(
"Communication with satellite lost while subkernel {} was running",
subkernel_finished.id
);
}
if let Some(exception) = subkernel_finished.exception {
if let Some(stream) = stream {
write_chunk(stream, &exception).await?;
}
}
}
let reply = control.borrow_mut().rx.async_recv().await; let reply = control.borrow_mut().rx.async_recv().await;
match reply { match reply {
kernel::Message::RpcSend { is_async, data } => { kernel::Message::RpcSend { is_async, data } => {

View File

@ -160,40 +160,6 @@ pub async fn destination_changed(
} }
} }
pub async fn get_finished_with_exception(
aux_mutex: &Rc<Mutex<bool>>,
routing_table: &RoutingTable,
timer: GlobalTimer,
) -> Result<Option<SubkernelFinished>, Error> {
let mut locked_subkernels = SUBKERNELS.async_lock().await;
for (id, subkernel) in locked_subkernels.iter_mut() {
match subkernel.state {
SubkernelState::Finished {
status: FinishStatus::Ok,
} => (),
SubkernelState::Finished { status } => {
subkernel.state = SubkernelState::Finished {
status: FinishStatus::Ok,
};
return Ok(Some(SubkernelFinished {
id: *id,
status: status,
exception: if status == FinishStatus::Exception {
Some(
drtio::subkernel_retrieve_exception(aux_mutex, routing_table, timer, subkernel.destination)
.await?,
)
} else {
None
},
}));
}
_ => (),
}
}
Ok(None)
}
pub async fn await_finish( pub async fn await_finish(
aux_mutex: &Rc<Mutex<bool>>, aux_mutex: &Rc<Mutex<bool>>,
routing_table: &RoutingTable, routing_table: &RoutingTable,