Commit 113af694 authored by Jeremy Soller's avatar Jeremy Soller

Remove scheme if closed

parent 4b2c15f0
......@@ -309,7 +309,15 @@ impl Scheme for RootScheme {
}
fn close(&self, file: usize) -> Result<usize> {
self.handles.write().remove(&file);
let handle = self.handles.write().remove(&file).ok_or(Error::new(EBADF))?;
match handle {
Handle::Scheme(inner) => {
let scheme_id = inner.scheme_id.load(Ordering::SeqCst);
let mut schemes = scheme::schemes_mut();
schemes.remove(scheme_id);
},
_ => ()
}
Ok(0)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment