Coverage Report

Created: 2025-10-10 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/process.rs
Line
Count
Source
1
#![cfg_attr(not(feature = "rt"), allow(dead_code))]
2
3
//! Process driver.
4
5
use crate::process::unix::GlobalOrphanQueue;
6
use crate::runtime::driver;
7
use crate::runtime::signal::{Driver as SignalDriver, Handle as SignalHandle};
8
9
use std::time::Duration;
10
11
/// Responsible for cleaning up orphaned child processes on Unix platforms.
12
#[derive(Debug)]
13
pub(crate) struct Driver {
14
    park: SignalDriver,
15
    signal_handle: SignalHandle,
16
}
17
18
// ===== impl Driver =====
19
20
impl Driver {
21
    /// Creates a new signal `Driver` instance that delegates wakeups to `park`.
22
17.3k
    pub(crate) fn new(park: SignalDriver) -> Self {
23
17.3k
        let signal_handle = park.handle();
24
25
17.3k
        Self {
26
17.3k
            park,
27
17.3k
            signal_handle,
28
17.3k
        }
29
17.3k
    }
30
31
21.2k
    pub(crate) fn park(&mut self, handle: &driver::Handle) {
32
21.2k
        self.park.park(handle);
33
21.2k
        GlobalOrphanQueue::reap_orphans(&self.signal_handle);
34
21.2k
    }
35
36
0
    pub(crate) fn park_timeout(&mut self, handle: &driver::Handle, duration: Duration) {
37
0
        self.park.park_timeout(handle, duration);
38
0
        GlobalOrphanQueue::reap_orphans(&self.signal_handle);
39
0
    }
40
41
17.3k
    pub(crate) fn shutdown(&mut self, handle: &driver::Handle) {
42
17.3k
        self.park.shutdown(handle);
43
17.3k
    }
44
}