mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
process: do not publicly turn on signal
when enabled (#2871)
This change will still internally compile any `signal` resources required when `process` is enabled on unix systems, but it will not publicly turn on the cargo feature
This commit is contained in:
parent
4dfbdbff7e
commit
a1d0681cd2
@ -59,10 +59,11 @@ macros = ["tokio-macros"]
|
|||||||
net = ["dns", "tcp", "udp", "uds"]
|
net = ["dns", "tcp", "udp", "uds"]
|
||||||
process = [
|
process = [
|
||||||
"io-driver",
|
"io-driver",
|
||||||
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"mio-named-pipes",
|
"mio-named-pipes",
|
||||||
"signal",
|
"mio-uds",
|
||||||
"winapi/consoleapi",
|
"signal-hook-registry",
|
||||||
"winapi/threadpoollegacyapiset",
|
"winapi/threadpoollegacyapiset",
|
||||||
]
|
]
|
||||||
# Includes basic task execution capabilities
|
# Includes basic task execution capabilities
|
||||||
|
@ -372,6 +372,13 @@ cfg_signal! {
|
|||||||
pub mod signal;
|
pub mod signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg_signal_internal! {
|
||||||
|
#[cfg(not(feature = "signal"))]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[allow(unreachable_pub)]
|
||||||
|
pub(crate) mod signal;
|
||||||
|
}
|
||||||
|
|
||||||
cfg_stream! {
|
cfg_stream! {
|
||||||
pub mod stream;
|
pub mod stream;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,25 @@ macro_rules! cfg_signal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! cfg_signal_internal {
|
||||||
|
($($item:item)*) => {
|
||||||
|
$(
|
||||||
|
#[cfg(any(feature = "signal", all(unix, feature = "process")))]
|
||||||
|
#[cfg(not(loom))]
|
||||||
|
$item
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! cfg_not_signal_internal {
|
||||||
|
($($item:item)*) => {
|
||||||
|
$(
|
||||||
|
#[cfg(any(loom, not(unix), not(any(feature = "signal", all(unix, feature = "process")))))]
|
||||||
|
$item
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! cfg_stream {
|
macro_rules! cfg_stream {
|
||||||
($($item:item)*) => {
|
($($item:item)*) => {
|
||||||
$(
|
$(
|
||||||
|
@ -22,7 +22,7 @@ cfg_io_driver! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_signal! {
|
cfg_signal_internal! {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub(crate) fn signal_handle() -> crate::runtime::driver::SignalHandle {
|
pub(crate) fn signal_handle() -> crate::runtime::driver::SignalHandle {
|
||||||
CONTEXT.with(|ctx| match *ctx.borrow() {
|
CONTEXT.with(|ctx| match *ctx.borrow() {
|
||||||
|
@ -38,26 +38,14 @@ cfg_not_io_driver! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===== signal driver =====
|
// ===== signal driver =====
|
||||||
|
macro_rules! cfg_signal_internal_and_unix {
|
||||||
macro_rules! cfg_unix_and_signal {
|
|
||||||
($($item:item)*) => {
|
($($item:item)*) => {
|
||||||
$(
|
#[cfg(unix)]
|
||||||
#[cfg(all(not(loom), unix, feature = "signal"))]
|
cfg_signal_internal! { $($item)* }
|
||||||
$item
|
|
||||||
)*
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! cfg_neither_unix_nor_windows {
|
cfg_signal_internal_and_unix! {
|
||||||
($($item:item)*) => {
|
|
||||||
$(
|
|
||||||
#[cfg(any(loom, not(all(unix, feature = "signal"))))]
|
|
||||||
$item
|
|
||||||
)*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg_unix_and_signal! {
|
|
||||||
type SignalDriver = crate::park::Either<crate::signal::unix::driver::Driver, IoDriver>;
|
type SignalDriver = crate::park::Either<crate::signal::unix::driver::Driver, IoDriver>;
|
||||||
pub(crate) type SignalHandle = Option<crate::signal::unix::driver::Handle>;
|
pub(crate) type SignalHandle = Option<crate::signal::unix::driver::Handle>;
|
||||||
|
|
||||||
@ -76,7 +64,7 @@ cfg_unix_and_signal! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_neither_unix_nor_windows! {
|
cfg_not_signal_internal! {
|
||||||
type SignalDriver = IoDriver;
|
type SignalDriver = IoDriver;
|
||||||
pub(crate) type SignalHandle = ();
|
pub(crate) type SignalHandle = ();
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ use std::convert::TryFrom;
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use winapi::shared::minwindef::*;
|
use winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE};
|
||||||
use winapi::um::consoleapi::SetConsoleCtrlHandler;
|
use winapi::um::consoleapi::SetConsoleCtrlHandler;
|
||||||
use winapi::um::wincon::*;
|
use winapi::um::wincon::{CTRL_BREAK_EVENT, CTRL_C_EVENT};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct OsStorage {
|
pub(crate) struct OsStorage {
|
||||||
|
@ -471,7 +471,7 @@ cfg_not_sync! {
|
|||||||
feature = "signal"))]
|
feature = "signal"))]
|
||||||
pub(crate) mod oneshot;
|
pub(crate) mod oneshot;
|
||||||
|
|
||||||
cfg_signal! {
|
cfg_signal_internal! {
|
||||||
pub(crate) mod mpsc;
|
pub(crate) mod mpsc;
|
||||||
pub(crate) mod semaphore_ll;
|
pub(crate) mod semaphore_ll;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user