id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage}; use crate::sync::mpsc::error::TryRecvE...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:6
} /// Our global signal handler for all signals registered by this module. /// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up the driver by writing a byte to a pipe /// /// Those two operations should both be asyn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
let mut registered = Ok(()); siginfo.init.call_once(|| { registered = unsafe { signal_hook_registry::register(signal, move || action(globals, signal)).map(|_| ()) }; if registered.is_ok() { siginfo.initialized.store(true, Ordering::Relaxed); } }); regi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:9
/// println!("got signal HUP"); /// } /// } /// ``` #[must_use = "streams do nothing unless polled"] #[derive(Debug)] pub struct Signal { rx: Receiver<()>, } /// Creates a new stream which will receive notifications when the current /// process receives the specified signal `kind`. /// /// This functio...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
321
380
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// `async` context. /// /// This method returns: /// /// * `Poll::Pending` if no signals are available but the channel is not /// closed. /// * `Poll::Ready(Some(()))` if a signal is available. /// * `Poll::Ready(None)` if the channel has been closed and all signals /// sent be...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:12
} } // Work around for abstracting streams internally pub(crate) trait InternalStream: Unpin { fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>>; fn try_recv(&mut self) -> Result<(), TryRecvError>; } impl InternalStream for Signal { fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Opt...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
77ca8a934cf76ec74144ec11e78ae7c7efbe910a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/77ca8a934cf76ec74144ec11e78ae7c7efbe910a/tokio/src/signal/unix.rs
441
477
tokio-rs/tokio:tokio/src/signal/unix.rs:10
signal_enable(signal, handle)?; // One wakeup in a queue is enough, no need for us to buffer up any // more. let (tx, rx) = channel(1); globals().register_listener(signal as EventId, tx); Ok(Signal { rx }) } impl Signal { /// Receives the next signal notification event. /// /// `None`...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
self.rx.poll_recv(cx) } /// Try to receive a signal notification without blocking or registering a waker. pub(crate) fn try_recv(&mut self) -> Result<(), TryRecvError> { self.rx.try_recv() } } // Work around for abstracting streams internally pub(crate) trait InternalStream: Unpin { fn pol...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/unix.rs
401
443
tokio-rs/tokio:tokio/src/signal/unix.rs:10
signal_enable(signal, handle)?; // One wakeup in a queue is enough, no need for us to buffer up any // more. let (tx, rx) = channel(1); globals().register_listener(signal as EventId, tx); Ok(Signal { rx }) } impl Signal { /// Receives the next signal notification event. /// /// `None`...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4cf45c038b9691f24fac22df13594c2223b185f6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
self.rx.poll_recv(cx) } /// Try to receive a signal notification without blocking or registering a waker. pub(crate) fn try_recv(&mut self) -> Result<(), TryRecvError> { self.rx.try_recv() } } cfg_stream! { impl crate::stream::Stream for Signal { type Item = (); fn poll_ne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4cf45c038b9691f24fac22df13594c2223b185f6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix.rs
401
453
tokio-rs/tokio:tokio/src/signal/unix.rs:12
mod tests { use super::*; #[test] fn signal_enable_error_on_invalid_input() { signal_enable(-1, Handle::default()).unwrap_err(); } #[test] fn signal_enable_error_on_forbidden_input() { signal_enable(signal_hook_registry::FORBIDDEN[0], Handle::default()).unwrap_err(); } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4cf45c038b9691f24fac22df13594c2223b185f6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix.rs
441
453
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage}; use crate::sync::mpsc::{channel, Recei...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:2
{ self.iter().map(|si| &si.event_info).for_each(f) } } #[derive(Debug)] pub(crate) struct OsExtraData { sender: UnixStream, receiver: UnixStream, } impl Init for OsExtraData { fn init() -> Self { let (receiver, sender) = UnixStream::pair().expect("failed to create UnixStream"); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix.rs:3
/// On Unix systems this signal is sent when a real-time timer has expired. /// By default, the process is terminated by this signal. pub fn alarm() -> Self { Self(libc::SIGALRM) } /// Represents the SIGCHLD signal. /// /// On Unix systems this signal is sent when the status of a child ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix.rs:4
/// By default, the process is terminated by this signal. pub fn interrupt() -> Self { Self(libc::SIGINT) } /// Represents the SIGIO signal. /// /// On Unix systems this signal is sent when I/O operations are possible /// on some file descriptor. By default, this signal is ignored. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
121
180
tokio-rs/tokio:tokio/src/signal/unix.rs:5
/// /// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a user defined signal. /// By default, the p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
/// Our global signal handler for all signals registered by this module. /// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up the driver by writing a byte to a pipe /// /// Those two operations should both be async-s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
registered = unsafe { signal_hook_registry::register(signal, move || action(globals, signal)).map(|_| ()) }; if registered.is_ok() { siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:9
/// } /// ``` #[must_use = "streams do nothing unless polled"] #[derive(Debug)] pub struct Signal { rx: Receiver<()>, } /// Creates a new stream which will receive notifications when the current /// process receives the specified signal `kind`. /// /// This function will create a new stream which binds to the defa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
321
380
tokio-rs/tokio:tokio/src/signal/unix.rs:10
Ok(Signal { rx }) } impl Signal { /// Receives the next signal notification event. /// /// `None` is returned if no more events can be received by this stream. /// /// # Examples /// /// Wait for SIGHUP /// /// ```rust,no_run /// use tokio::signal::unix::{signal, SignalKind}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
type Item = (); fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> { self.poll_recv(cx) } } } pub(crate) fn ctrl_c() -> io::Result<Signal> { signal(SignalKind::interrupt()) } #[cfg(all(test, not(loom)))] mod tests { use super::*; #[...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
1e585ccb516c8dc7c13cbc3d50f8ca49260b9617
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix.rs
401
426
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage}; use crate::sync::mpsc::{channel, Recei...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// Polling from a manually implemented future /// /// ```rust,no_run /// use std::pin::Pin; /// use std::future::Future; /// use std::task::{Context, Poll}; /// use tokio::signal::unix::Signal; /// /// struct MyFuture { /// signal: Signal, /// } /// /// impl Future f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/signal/unix.rs
401
454
tokio-rs/tokio:tokio/src/signal/unix.rs:12
#[cfg(all(test, not(loom)))] mod tests { use super::*; #[test] fn signal_enable_error_on_invalid_input() { signal_enable(-1).unwrap_err(); } #[test] fn signal_enable_error_on_forbidden_input() { signal_enable(signal_hook_registry::FORBIDDEN[0]).unwrap_err(); } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/signal/unix.rs
441
454
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::io::{AsyncRead, PollEvented, ReadBuf}; use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:2
self.iter().map(|si| &si.event_info).for_each(f) } } #[derive(Debug)] pub(crate) struct OsExtraData { sender: UnixStream, receiver: UnixStream, } impl Init for OsExtraData { fn init() -> Self { let (receiver, sender) = UnixStream::pair().expect("failed to create UnixStream"); Self { s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix.rs:3
/// By default, the process is terminated by this signal. pub fn alarm() -> Self { Self(libc::SIGALRM) } /// Represents the SIGCHLD signal. /// /// On Unix systems this signal is sent when the status of a child process /// has changed. By default, this signal is ignored. pub fn chil...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix.rs:4
pub fn interrupt() -> Self { Self(libc::SIGINT) } /// Represents the SIGIO signal. /// /// On Unix systems this signal is sent when I/O operations are possible /// on some file descriptor. By default, this signal is ignored. pub fn io() -> Self { Self(libc::SIGIO) } ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
121
180
tokio-rs/tokio:tokio/src/signal/unix.rs:5
/// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a user defined signal. /// By default, the process i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
/// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up driver tasks by writing a byte to a pipe /// /// Those two operations shoudl both be async-signal safe. fn action(globals: Pin<&'static Globals>, signal: c_int) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the next attempt to register the signal. In // such case it is not run, registered is still `Ok(())`, initialized is still `false`. if siginfo.initialized.load(Ordering::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// receiving wake up notifications, or there could be some race condition // when consuming readiness events, but having distinct descriptors for // distinct PollEvented instances appears to mitigate this. // // Unfortunately we cannot just use a single global PollEvented instance ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// A `Signal` stream can be created for a particular signal number /// multiple times. When a signal is received then all the associated /// channels will receive the signal notification. /// /// # Errors /// /// * If the lower-level C functions fail for some reason. /// * If the previous initialization of this specif...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:12
/// #[tokio::main] /// async fn main() -> Result<(), Box<dyn std::error::Error>> { /// // An infinite stream of hangup signals. /// let mut stream = signal(SignalKind::hangup())?; /// /// // Print whenever a HUP signal is received /// loop { /// stream.recv().await; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
441
500
tokio-rs/tokio:tokio/src/signal/unix.rs:13
/// println!("polling MyFuture"); /// self.signal.poll_recv(cx) /// } /// } /// ``` pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> { let _ = self.driver.poll(cx); self.rx.poll_recv(cx) } } cfg_stream! { impl crate::stream::Stream fo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/src/signal/unix.rs
481
519
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::io::{AsyncRead, PollEvented}; use crate::signal::registry::{globals, EventId, EventInfo, Globals, Init, Storage...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// receiving wake up notifications, or there could be some race condition // when consuming readiness events, but having distinct descriptors for // distinct PollEvented instances appears to mitigate this. // // Unfortunately we cannot just use a single global PollEvented instance ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// ```rust,no_run /// use tokio::signal::unix::{signal, SignalKind}; /// /// #[tokio::main] /// async fn main() -> Result<(), Box<dyn std::error::Error>> { /// // An infinite stream of hangup signals. /// let mut stream = signal(SignalKind::hangup())?; /// /// // Print whenever a HUP signal is received ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// * If the lower-level C functions fail for some reason. /// * If the previous initialization of this specific signal failed. /// * If the signal is one of /// [`signal_hook::FORBIDDEN`](fn@signal_hook_registry::register#panics) pub fn signal(kind: SignalKind) -> io::Result<Signal> { let signal = kind.0; /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:12
/// loop { /// stream.recv().await; /// println!("got signal HUP"); /// } /// } /// ``` pub async fn recv(&mut self) -> Option<()> { use crate::future::poll_fn; poll_fn(|cx| self.poll_recv(cx)).await } /// Polls to receive the next signal notifica...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
441
500
tokio-rs/tokio:tokio/src/signal/unix.rs:13
let _ = self.driver.poll(cx); self.rx.poll_recv(cx) } } cfg_stream! { impl crate::stream::Stream for Signal { type Item = (); fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> { self.poll_recv(cx) } } } pub(crate) fn ctr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e70a1b6d64ac2b3943d674d8f3b0b362fdc668b9/tokio/src/signal/unix.rs
481
513
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// ```rust,no_run /// use tokio::signal::unix::{signal, SignalKind}; /// /// #[tokio::main] /// async fn main() -> Result<(), Box<dyn std::error::Error>> { /// // An infinite stream of hangup signals. /// let mut stream = signal(SignalKind::hangup())?; /// /// // Print whenever a HUP signal is received ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// * If the lower-level C functions fail for some reason. /// * If the previous initialization of this specific signal failed. /// * If the signal is one of /// [`signal_hook::FORBIDDEN`](https://docs.rs/signal-hook/*/signal_hook/fn.register.html#panics) pub fn signal(kind: SignalKind) -> io::Result<Signal> { le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:5
/// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a user defined signal. /// By default, the process i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
bd28a7a767692f84c4dd0a78556ba5cb76d258e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd28a7a767692f84c4dd0a78556ba5cb76d258e5/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
/// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up driver tasks by writing a byte to a pipe /// /// Those two operations shoudl both be async-signal safe. fn action(globals: Pin<&'static Globals>, signal: c_int) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
bd28a7a767692f84c4dd0a78556ba5cb76d258e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd28a7a767692f84c4dd0a78556ba5cb76d258e5/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the next attempt to register the signal. In // such case it is not run, registered is still `Ok(())`, initialized is still false. if siginfo.initialized.load(Ordering::Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
bd28a7a767692f84c4dd0a78556ba5cb76d258e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd28a7a767692f84c4dd0a78556ba5cb76d258e5/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// * If the lower-level C functions fail for some reason. /// * If the previous initialization of this specific signal failed. /// * If the signal is one of /// [`signal_hook::FORBIDDEN`](https://docs.rs/signal-hook/*/signal_hook/fn.register.html#panics) pub fn signal(kind: SignalKind) -> io::Result<Signal> { le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
bd28a7a767692f84c4dd0a78556ba5cb76d258e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd28a7a767692f84c4dd0a78556ba5cb76d258e5/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:12
/// loop { /// stream.recv().await; /// println!("got signal HUP"); /// } /// } /// ``` pub async fn recv(&mut self) -> Option<()> { use crate::future::poll_fn; poll_fn(|cx| self.poll_recv(cx)).await } /// Poll to receive the next signal notificat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
bd28a7a767692f84c4dd0a78556ba5cb76d258e5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/bd28a7a767692f84c4dd0a78556ba5cb76d258e5/tokio/src/signal/unix.rs
441
500
tokio-rs/tokio:tokio/src/signal/unix.rs:7
siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the next attempt to register the signal. In // such case it is not run, registered is still `Ok(())`, initialized is still false. if siginfo.initialized.load(Ordering::Re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// receiving wake up notifications, or there could be some race condition // when consuming readiness events, but having distinct descriptors for // distinct PollEvented instances appears to mitigate this. // // Unfortunately we cannot just use a single global PollEvented instance ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// /// #[tokio::main] /// async fn main() -> Result<(), Box<dyn std::error::Error>> { /// // An infinite stream of hangup signals. /// let mut stream = signal(SignalKind::hangup())?; /// /// // Print whenever a HUP signal is received /// loop { /// stream.recv().await; /// println!("got...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
/// * If the signal is one of /// [`signal_hook::FORBIDDEN`](https://docs.rs/signal-hook/*/signal_hook/fn.register.html#panics) pub fn signal(kind: SignalKind) -> io::Result<Signal> { let signal = kind.0; // Turn the signal delivery on once we are ready for it signal_enable(signal)?; // Ensure there...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
401
460
tokio-rs/tokio:tokio/src/signal/unix.rs:12
/// println!("got signal HUP"); /// } /// } /// ``` pub async fn recv(&mut self) -> Option<()> { use crate::future::poll_fn; poll_fn(|cx| self.poll_recv(cx)).await } /// Poll to receive the next signal notification event, outside of an /// `async` context. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
441
500
tokio-rs/tokio:tokio/src/signal/unix.rs:13
} } cfg_stream! { impl crate::stream::Stream for Signal { type Item = (); fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> { self.poll_recv(cx) } } } pub(crate) fn ctrl_c() -> io::Result<Signal> { signal(SignalKind::interrupt()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/unix.rs
481
511
tokio-rs/tokio:tokio/src/signal/unix.rs:12
/// println!("got signal HUP"); /// } /// } /// ``` pub async fn recv(&mut self) -> Option<()> { use crate::future::poll_fn; poll_fn(|cx| self.poll_recv(cx)).await } /// Poll to receive the next signal notification event, outside of an /// `async` context. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
aef434c089754051e4a10c0e618f46003f31d2dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/aef434c089754051e4a10c0e618f46003f31d2dc/tokio/src/signal/unix.rs
441
500
tokio-rs/tokio:tokio/src/signal/unix.rs:13
} } cfg_stream! { impl futures_core::Stream for Signal { type Item = (); fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> { self.poll_recv(cx) } } } pub(crate) fn ctrl_c() -> io::Result<Signal> { signal(SignalKind::interrupt())...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
aef434c089754051e4a10c0e618f46003f31d2dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/aef434c089754051e4a10c0e618f46003f31d2dc/tokio/src/signal/unix.rs
481
511
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// receiving wake up notifications, or there could be some race condition // when consuming readiness events, but having distinct descriptors for // distinct PollEvented instances appears to mitigate this. // // Unfortunately we cannot just use a single global PollEvented instance ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
cd73951130286bc7c8ff113084e00a71eced4b60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cd73951130286bc7c8ff113084e00a71eced4b60/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// * Signals may be coalesced beyond what the kernel already does. /// * Once a signal handler is registered with the process the underlying /// libc signal handler is never unregistered. /// /// A `Signal` stream can be created for a particular signal number /// multiple times. When a signal is received then all th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
cd73951130286bc7c8ff113084e00a71eced4b60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cd73951130286bc7c8ff113084e00a71eced4b60/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> { let _ = self.driver.poll(cx); self.rx.poll_recv(cx) } } cfg_stream! { impl futures_core::Stream for Signal { type Item = (); fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Op...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
cd73951130286bc7c8ff113084e00a71eced4b60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cd73951130286bc7c8ff113084e00a71eced4b60/tokio/src/signal/unix.rs
401
434
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// * Signals may be coalesced beyond what the kernel already does. /// * Once a signal handler is registered with the process the underlying /// libc signal handler is never unregistered. /// /// A `Signal` stream can be created for a particular signal number /// multiple times. When a signal is received then all th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
69975fb9601bbb21659db283d888470733bae660
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> { let _ = self.driver.poll(cx); self.rx.poll_recv(cx) } } pub(crate) fn ctrl_c() -> io::Result<Signal> { signal(SignalKind::interrupt()) } #[cfg(all(test, not(loom)))] mod tests { use super::*; #[test] fn signal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
69975fb9601bbb21659db283d888470733bae660
github
async-runtime
https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/signal/unix.rs
401
424
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::io::AsyncRead; use crate::net::util::PollEvented; use crate::signal::registry::{globals, EventId, EventInfo, Gl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:5
/// /// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a user defined signal. /// By default, the p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
/// Our global signal handler for all signals registered by this module. /// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up driver tasks by writing a byte to a pipe /// /// Those two operations shoudl both be async...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
if registered.is_ok() { siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the next attempt to register the signal. In // such case it is not run, registered is still `Ok(())`, initialized is still false. if s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// I'm not sure if the second (failed) registration simply doesn't end up // receiving wake up notifications, or there could be some race condition // when consuming readiness events, but having distinct descriptors for // distinct PollEvented instances appears to mitigate this. // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// /// * Signals may be coalesced beyond what the kernel already does. /// * Once a signal handler is registered with the process the underlying /// libc signal handler is never unregistered. /// /// A `Signal` stream can be created for a particular signal number /// multiple times. When a signal is received then al...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
#[doc(hidden)] // TODO: document pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> { let _ = self.driver.poll(cx); self.rx.poll_recv(cx) } } pub(crate) fn ctrl_c() -> io::Result<Signal> { signal(SignalKind::interrupt()) } #[cfg(all(test, not(loom)))] mod tests { use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/unix.rs
401
425
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::io::AsyncRead; use crate::net::util::PollEvented; use crate::signal::registry::{globals, EventId, EventInfo, Gl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:5
/// Represents the SIGUSR1 signal. /// /// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a user de...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
} /// Our global signal handler for all signals registered by this module. /// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up driver tasks by writing a byte to a pipe /// /// Those two operations shoudl both be as...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
signal_hook_registry::register(signal, move || action(globals, signal)).map(|_| ()) }; if registered.is_ok() { siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the next attempt to register the signal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// the issues described in alexcrichton/tokio-process#42. // // In the past we would reuse the actual receiver file descriptor and // swallow any errors around double registration of the same descriptor. // I'm not sure if the second (failed) registration simply doesn't end up //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// This function will create a new stream which binds to the default reactor. /// The `Signal` stream is an infinite stream which will receive /// notifications whenever a signal is received. More documentation can be /// found on `Signal` itself, but to reiterate: /// /// * Signals may be coalesced beyond what the ke...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
impl Stream for Signal { type Item = (); fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { let _ = Pin::new(&mut self.driver).poll(cx); self.rx.poll_recv(cx) } } #[cfg(all(test, not(loom)))] mod tests { use super::*; #[test] fn signal_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
2b909d6805990abf0bc2a5dea9e7267ff87df704
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/unix.rs
401
425
tokio-rs/tokio:tokio/src/signal/unix.rs:1
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] use crate::io::AsyncRead; use crate::net::util::PollEvented; use crate::signal::registry::{globals, EventId, EventInfo, Gl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix.rs:2
fn for_each<'a, F>(&'a self, f: F) where F: FnMut(&'a EventInfo), { self.iter().map(|si| &si.event_info).for_each(f) } } #[derive(Debug)] pub(crate) struct OsExtraData { sender: UnixStream, receiver: UnixStream, } impl Init for OsExtraData { fn init() -> Self { let (rec...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix.rs:3
/// Represents the SIGALRM signal. /// /// On Unix systems this signal is sent when a real-time timer has expired. /// By default, the process is terminated by this signal. pub fn alarm() -> Self { Self(libc::SIGALRM) } /// Represents the SIGCHLD signal. /// /// On Unix systems ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix.rs:4
/// Represents the SIGINT signal. /// /// On Unix systems this signal is sent to interrupt a program. /// By default, the process is terminated by this signal. pub fn interrupt() -> Self { Self(libc::SIGINT) } /// Represents the SIGIO signal. /// /// On Unix systems this signal ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
121
180
tokio-rs/tokio:tokio/src/signal/unix.rs:5
} /// Represents the SIGUSR1 signal. /// /// On Unix systems this is a user defined signal. /// By default, the process is terminated by this signal. pub fn user_defined1() -> Self { Self(libc::SIGUSR1) } /// Represents the SIGUSR2 signal. /// /// On Unix systems this is a ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
161
220
tokio-rs/tokio:tokio/src/signal/unix.rs:6
} } /// Our global signal handler for all signals registered by this module. /// /// The purpose of this signal handler is to primarily: /// /// 1. Flag that our specific signal was received (e.g. store an atomic flag) /// 2. Wake up driver tasks by writing a byte to a pipe /// /// Those two operations shoudl both be ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
201
260
tokio-rs/tokio:tokio/src/signal/unix.rs:7
registered = unsafe { signal_hook_registry::register(signal, move || action(globals, signal)).map(|_| ()) }; if registered.is_ok() { siginfo.initialized.store(true, Ordering::Relaxed); } }); registered?; // If the call_once failed, it won't be retried on the n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
241
300
tokio-rs/tokio:tokio/src/signal/unix.rs:8
// NB: We give each driver a "fresh" reciever file descriptor to avoid // the issues described in alexcrichton/tokio-process#42. // // In the past we would reuse the actual receiver file descriptor and // swallow any errors around double registration of the same descriptor. // I'...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
281
340
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// /// This function will create a new stream which binds to the default reactor. /// The `Signal` stream is an infinite stream which will receive /// notifications whenever a signal is received. More documentation can be /// found on `Signal` itself, but to reiterate: /// /// * Signals may be coalesced beyond what th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
} impl Stream for Signal { type Item = (); fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { let _ = Pin::new(&mut self.driver).poll(cx); self.rx.poll_recv(cx) } } #[cfg(all(test, not(loom)))] mod tests { use super::*; #[test] fn sign...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
7eb264a0d0ee68433b20ecafabed53a70a9d43a4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/unix.rs
401
426
tokio-rs/tokio:tokio/src/signal/unix.rs:10
/// /// This function will create a new stream which binds to the default reactor. /// The `Signal` stream is an infinite stream which will receive /// notifications whenever a signal is received. More documentation can be /// found on `Signal` itself, but to reiterate: /// /// * Signals may be coalesced beyond what th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
987ba7373cf95c570bf23768c6021f7a7508286e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/src/signal/unix.rs
361
420
tokio-rs/tokio:tokio/src/signal/unix.rs:11
} impl Stream for Signal { type Item = (); fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { let _ = Pin::new(&mut self.driver).poll(cx); self.rx.poll_recv(cx) } } #[cfg(test)] mod tests { use super::*; #[test] fn signal_enable_error_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix.rs
MIT
987ba7373cf95c570bf23768c6021f7a7508286e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/src/signal/unix.rs
401
426
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1
#![cfg_attr(not(feature = "rt"), allow(dead_code))] //! Signal driver use crate::io::interest::Interest; use crate::io::PollEvented; use crate::runtime::io; use crate::signal::registry::globals; use mio::net::UnixStream; use std::io::{self as std_io, Read}; use std::ptr; use std::sync::{Arc, Weak}; use std::task::{C...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/signal/unix/driver.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:2
// ===== impl Driver ===== impl Driver { /// Creates a new signal `Driver` instance that delegates wakeups to `park`. pub(crate) fn new(park: io::Driver) -> std_io::Result<Self> { use std::mem::ManuallyDrop; use std::os::unix::io::{AsRawFd, FromRawFd}; // NB: We give each driver a "fre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/signal/unix/driver.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3
park, receiver, inner: Arc::new(Inner(())), }) } /// Returns a handle to this event loop which can be sent across threads /// and can be used as a proxy to the event loop itself. pub(crate) fn handle(&self) -> Handle { Handle { inner: Arc::downgrade(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/signal/unix/driver.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4
}; // Drain the pipe completely so we can receive a new readiness event // if another signal has come in. let mut buf = [0; 128]; loop { match (&*self.receiver).read(&mut buf) { Ok(0) => panic!("EOF on self-pipe"), Ok(_) => continue, // Keep r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/signal/unix/driver.rs
121
180
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5
} } } cfg_rt! { impl Handle { /// Returns a handle to the current driver /// /// # Panics /// /// This function panics if there is no current signal driver set. #[track_caller] pub(super) fn current() -> Self { crate::runtime::context::signal_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/signal/unix/driver.rs
161
196
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:2
// ===== impl Driver ===== impl Driver { /// Creates a new signal `Driver` instance that delegates wakeups to `park`. pub(crate) fn new(park: io::Driver) -> std_io::Result<Self> { use std::mem::ManuallyDrop; use std::os::unix::io::{AsRawFd, FromRawFd}; // NB: We give each driver a "fre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/signal/unix/driver.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3
park, receiver, inner: Arc::new(Inner(())), }) } /// Returns a handle to this event loop which can be sent across threads /// and can be used as a proxy to the event loop itself. pub(crate) fn handle(&self) -> Handle { Handle { inner: Arc::downgrade(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/signal/unix/driver.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4
let ev = match self.receiver.registration().poll_read_ready(&mut cx) { Poll::Ready(Ok(ev)) => ev, Poll::Ready(Err(e)) => panic!("reactor gone: {}", e), Poll::Pending => return, // No wake has arrived, bail }; // Drain the pipe completely so we can receive a new readi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/signal/unix/driver.rs
121
180
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5
Err(std_io::Error::new( std_io::ErrorKind::Other, "signal driver gone", )) } } } cfg_rt! { impl Handle { /// Returns a handle to the current driver /// /// # Panics /// /// This function panics if there is no current si...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/signal/unix/driver.rs
161
200
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:2
// ===== impl Driver ===== impl Driver { /// Creates a new signal `Driver` instance that delegates wakeups to `park`. pub(crate) fn new(park: io::Driver) -> std_io::Result<Self> { use std::mem::ManuallyDrop; use std::os::unix::io::{AsRawFd, FromRawFd}; // NB: We give each driver a "fre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/signal/unix/driver.rs
41
100
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3
park, receiver, inner: Arc::new(Inner(())), }) } /// Returns a handle to this event loop which can be sent across threads /// and can be used as a proxy to the event loop itself. pub(crate) fn handle(&self) -> Handle { Handle { inner: Arc::downgrade(&...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/signal/unix/driver.rs
81
140
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1
#![cfg_attr(not(feature = "rt"), allow(dead_code))] //! Signal driver use crate::io::interest::Interest; use crate::io::PollEvented; use crate::park::Park; use crate::runtime::io::Driver as IoDriver; use crate::signal::registry::globals; use mio::net::UnixStream; use std::io::{self, Read}; use std::ptr; use std::syn...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
218f2629fffa25912ee14a2cc8ec6e98ae223b11
github
async-runtime
https://github.com/tokio-rs/tokio/blob/218f2629fffa25912ee14a2cc8ec6e98ae223b11/tokio/src/signal/unix/driver.rs
1
60
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:2
pub(super) struct Inner(()); // ===== impl Driver ===== impl Driver { /// Creates a new signal `Driver` instance that delegates wakeups to `park`. pub(crate) fn new(park: IoDriver) -> io::Result<Self> { use std::mem::ManuallyDrop; use std::os::unix::io::{AsRawFd, FromRawFd}; // NB: We...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/signal/unix/driver.rs
MIT
218f2629fffa25912ee14a2cc8ec6e98ae223b11
github
async-runtime
https://github.com/tokio-rs/tokio/blob/218f2629fffa25912ee14a2cc8ec6e98ae223b11/tokio/src/signal/unix/driver.rs
41
100