mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
Add a method to manually deregister an I/O object
Typically this happens automatically as the `E` in `PollEvented<E>` is an owned reference (e.g. a `TcpStream`) where dropping that will close the resource, automatically unregistering it from the event loop. In some situations, however, this isn't always the case, so the deregistering needs to happen manually.
This commit is contained in:
@@ -435,6 +435,10 @@ impl Inner {
|
||||
Ok((sched.readiness.clone(), entry.insert(sched).index()))
|
||||
}
|
||||
|
||||
fn deregister_source(&mut self, source: &mio::Evented) -> io::Result<()> {
|
||||
self.io.deregister(source)
|
||||
}
|
||||
|
||||
fn drop_source(&mut self, token: usize) {
|
||||
debug!("dropping I/O source: {}", token);
|
||||
self.io_dispatch.remove(token).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user