summaryrefslogtreecommitdiffstats
path: root/tokio/src/io
diff options
context:
space:
mode:
authorIvan Petkov <ivanppetkov@gmail.com>2020-09-22 15:40:44 -0700
committerGitHub <noreply@github.com>2020-09-22 15:40:44 -0700
commit7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb (patch)
tree990e22703eb7103b030f5e8bf117557684a9f205 /tokio/src/io
parente09b90ea32385337170ce17eb55ab372f9388af5 (diff)
signal: move driver to runtime thread (#2835)
Refactors the signal infrastructure to move the driver to the runtime thread. This follows the model put forth by the I/O driver and time driver.
Diffstat (limited to 'tokio/src/io')
-rw-r--r--tokio/src/io/registration.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tokio/src/io/registration.rs b/tokio/src/io/registration.rs
index 82065072..b805d2b9 100644
--- a/tokio/src/io/registration.rs
+++ b/tokio/src/io/registration.rs
@@ -109,7 +109,18 @@ impl Registration {
where
T: Evented,
{
- let handle = Handle::current();
+ Self::new_with_ready_and_handle(io, ready, Handle::current())
+ }
+
+ /// Same as `new_with_ready` but also accepts an explicit handle.
+ pub(crate) fn new_with_ready_and_handle<T>(
+ io: &T,
+ ready: mio::Ready,
+ handle: Handle,
+ ) -> io::Result<Registration>
+ where
+ T: Evented,
+ {
let shared = if let Some(inner) = handle.inner() {
inner.add_source(io, ready)?
} else {