Rust: unborrow cache after kernel stops.

This commit is contained in:
whitequark 2016-10-06 14:19:12 +00:00
parent e92f20546a
commit 3e829d0d01
2 changed files with 8 additions and 0 deletions

View File

@ -44,4 +44,10 @@ impl Cache {
}); });
Ok(()) Ok(())
} }
pub unsafe fn unborrow(&mut self) {
for (_key, entry) in self.entries.iter_mut() {
entry.borrowed = false;
}
}
} }

View File

@ -381,6 +381,7 @@ fn process_kern_message(waiter: Waiter,
kern::RunFinished => { kern::RunFinished => {
kernel::stop(); kernel::stop();
session.kernel_state = KernelState::Absent; session.kernel_state = KernelState::Absent;
unsafe { session.congress.cache.unborrow() }
match stream { match stream {
None => return Ok(true), None => return Ok(true),
@ -392,6 +393,7 @@ fn process_kern_message(waiter: Waiter,
kern::RunException { exception: ref exn, backtrace } => { kern::RunException { exception: ref exn, backtrace } => {
kernel::stop(); kernel::stop();
session.kernel_state = KernelState::Absent; session.kernel_state = KernelState::Absent;
unsafe { session.congress.cache.unborrow() }
match stream { match stream {
None => { None => {