summaryrefslogtreecommitdiffstats
path: root/tokio/src/signal
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-10-13 15:06:22 -0700
committerGitHub <noreply@github.com>2020-10-13 15:06:22 -0700
commit00b6127f2ed3125f8b305ab4fd9bb90e99762785 (patch)
treee43ba873fed9f2cc650b6b26cfb0422aabf1a9bd /tokio/src/signal
parenta249421abc44e768217427a68f5f5e23f9d1cbd5 (diff)
rt: switch `enter` to an RAII guard (#2954)
Diffstat (limited to 'tokio/src/signal')
-rw-r--r--tokio/src/signal/windows.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/tokio/src/signal/windows.rs b/tokio/src/signal/windows.rs
index 46271722..1e783622 100644
--- a/tokio/src/signal/windows.rs
+++ b/tokio/src/signal/windows.rs
@@ -253,21 +253,20 @@ mod tests {
#[test]
fn ctrl_c() {
let rt = rt();
+ let _enter = rt.enter();
- rt.enter(|| {
- let mut ctrl_c = task::spawn(crate::signal::ctrl_c());
+ let mut ctrl_c = task::spawn(crate::signal::ctrl_c());
- assert_pending!(ctrl_c.poll());
+ assert_pending!(ctrl_c.poll());
- // Windows doesn't have a good programmatic way of sending events
- // like sending signals on Unix, so we'll stub out the actual OS
- // integration and test that our handling works.
- unsafe {
- super::handler(CTRL_C_EVENT);
- }
+ // Windows doesn't have a good programmatic way of sending events
+ // like sending signals on Unix, so we'll stub out the actual OS
+ // integration and test that our handling works.
+ unsafe {
+ super::handler(CTRL_C_EVENT);
+ }
- assert_ready_ok!(ctrl_c.poll());
- });
+ assert_ready_ok!(ctrl_c.poll());
}
#[test]