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/driver.rs:3 | Ok(Self {
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 {
i... | 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 | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | self.receiver.registration().clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawWaker::new(ptr::null()... | 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 | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | }
}
// ===== impl Handle =====
impl Handle {
pub(super) fn check_inner(&self) -> io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::Other, "signal driver gone"))
}
}
}
cfg_rt! {
impl Handle {
/// Re... | 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 | 161 | 207 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::io::driver::{Driver as IoDriver, Interest};
use crate::io::PollEvented;
use crate::park::Park;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | d48c4370ceead56b1846bf638474cd9536d0fe62 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d48c4370ceead56b1846bf638474cd9536d0fe62/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: IoDriver) -> io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | d48c4370ceead56b1846bf638474cd9536d0fe62 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d48c4370ceead56b1846bf638474cd9536d0fe62/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 | d48c4370ceead56b1846bf638474cd9536d0fe62 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d48c4370ceead56b1846bf638474cd9536d0fe62/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | self.receiver.registration().clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawWaker::new(ptr::null()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | d48c4370ceead56b1846bf638474cd9536d0fe62 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d48c4370ceead56b1846bf638474cd9536d0fe62/tokio/src/signal/unix/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | }
// ===== impl Handle =====
impl Handle {
pub(super) fn check_inner(&self) -> io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::Other, "signal driver gone"))
}
}
}
cfg_rt! {
impl Handle {
/// Retu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | d48c4370ceead56b1846bf638474cd9536d0fe62 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d48c4370ceead56b1846bf638474cd9536d0fe62/tokio/src/signal/unix/driver.rs | 161 | 206 |
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: IoDriver) -> io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 18efef7d3b926750c0b026a401e85e723f401854 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18efef7d3b926750c0b026a401e85e723f401854/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3 | )?;
Ok(Self {
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 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 18efef7d3b926750c0b026a401e85e723f401854 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18efef7d3b926750c0b026a401e85e723f401854/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | }
}
self.receiver.registration().clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawW... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 18efef7d3b926750c0b026a401e85e723f401854 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18efef7d3b926750c0b026a401e85e723f401854/tokio/src/signal/unix/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | fn shutdown(&mut self) {
self.park.shutdown()
}
}
// ===== impl Handle =====
impl Handle {
pub(super) fn check_inner(&self) -> io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::Other, "signal driver gone"))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 18efef7d3b926750c0b026a401e85e723f401854 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/18efef7d3b926750c0b026a401e85e723f401854/tokio/src/signal/unix/driver.rs | 161 | 209 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | fn shutdown(&mut self) {
self.park.shutdown()
}
}
// ===== impl Handle =====
impl Handle {
pub(super) fn check_inner(&self) -> io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::Other, "signal driver gone"))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 08ed41f339e345286f26bdbc6c67bf9f2975ed07 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/08ed41f339e345286f26bdbc6c67bf9f2975ed07/tokio/src/signal/unix/driver.rs | 161 | 207 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::io::driver::{Driver as IoDriver, Interest};
use crate::io::PollEvented;
use crate::park::Park;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 02b1117dca1c1e1fcc700bff4d6a93c33bfbc7d8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/02b1117dca1c1e1fcc700bff4d6a93c33bfbc7d8/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: IoDriver) -> io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 02b1117dca1c1e1fcc700bff4d6a93c33bfbc7d8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/02b1117dca1c1e1fcc700bff4d6a93c33bfbc7d8/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::{Interest, PollEvented};
use crate::park::Park;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | ce891a4df17e632f7557dd0cd1f1e8da89bd6ae4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce891a4df17e632f7557dd0cd1f1e8da89bd6ae4/tokio/src/signal/unix/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::PollEvented;
use crate::park::Park;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std::task::{Cont... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/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: IoDriver) -> io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3 | )?;
Ok(Self {
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 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | }
}
self.receiver.clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawWaker::new(ptr::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/signal/unix/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | #![cfg_attr(not(feature = "rt-core"), allow(dead_code))]
//! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::PollEvented;
use crate::park::Park;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std::task::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/unix/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | }
}
self.receiver.clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawWaker::new(ptr::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/unix/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | fn shutdown(&mut self) {
self.park.shutdown()
}
}
// ===== impl Handle =====
impl Handle {
pub(super) fn check_inner(&self) -> io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::Other, "signal driver gone"))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/unix/driver.rs | 161 | 207 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | //! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::PollEvented;
use crate::park::Park;
use crate::runtime::context;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std::task::{Context, Poll, RawWaker, Raw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 4cf45c038b9691f24fac22df13594c2223b185f6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/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: IoDriver) -> io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 4cf45c038b9691f24fac22df13594c2223b185f6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3 | Ok(Self {
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 {
i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 4cf45c038b9691f24fac22df13594c2223b185f6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | }
self.receiver.clear_readiness(ev);
// Broadcast any signals which were received
globals().broadcast();
}
}
const NOOP_WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(noop_clone, noop, noop, noop);
unsafe fn noop_clone(_data: *const ()) -> RawWaker {
RawWaker::new(ptr::null(), &N... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 4cf45c038b9691f24fac22df13594c2223b185f6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:5 | self.park.shutdown()
}
}
// ===== impl Handle =====
impl Handle {
/// Returns a handle to the current driver
///
/// # Panics
///
/// This function panics if there is no current signal driver set.
pub(super) fn current() -> Self {
context::signal_handle().expect(
"there... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 4cf45c038b9691f24fac22df13594c2223b185f6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4cf45c038b9691f24fac22df13594c2223b185f6/tokio/src/signal/unix/driver.rs | 161 | 186 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | //! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::PollEvented;
use crate::park::Park;
use crate::runtime::context;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std::task::{Context, Poll, RawWaker, Raw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 1e585ccb516c8dc7c13cbc3d50f8ca49260b9617 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1e585ccb516c8dc7c13cbc3d50f8ca49260b9617/tokio/src/signal/unix/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | //! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::PollEvented;
use crate::park::Park;
use crate::runtime::context;
use crate::signal::registry::globals;
use mio_uds::UnixStream;
use std::io::{self, Read};
use std::ptr;
use std::sync::{Arc, Weak};
use std::task::{Context, Poll, RawWaker, RawWa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/src/signal/unix/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:2 | impl Driver {
/// Creates a new signal `Driver` instance that delegates wakeups to `park`.
pub(crate) fn new(park: IoDriver) -> io::Result<Self> {
// NB: We give each driver a "fresh" reciever file descriptor to avoid
// the issues described in alexcrichton/tokio-process#42.
//
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3 | // need to actually be notified when read ready...
let waker = unsafe { Waker::from_raw(RawWaker::new(ptr::null(), &NOOP_WAKER_VTABLE)) };
let mut cx = Context::from_waker(&waker);
let ev = match self.receiver.poll_read_ready(&mut cx) {
Poll::Ready(Ok(ev)) => ev,
Poll::R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | type Unpark = <IoDriver as Park>::Unpark;
type Error = io::Error;
fn unpark(&self) -> Self::Unpark {
self.park.unpark()
}
fn park(&mut self) -> Result<(), Self::Error> {
self.park.park()?;
self.process();
Ok(())
}
fn park_timeout(&mut self, duration: Duration) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | a0557840eb424e174bf81a0175c40f9e176a2cc2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0557840eb424e174bf81a0175c40f9e176a2cc2/tokio/src/signal/unix/driver.rs | 121 | 166 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:1 | //! Signal driver
use crate::io::driver::Driver as IoDriver;
use crate::io::Registration;
use crate::park::Park;
use crate::runtime::context;
use crate::signal::registry::globals;
use mio_uds::UnixStream;
use std::io::{self, Read};
use std::sync::{Arc, Weak};
use std::time::Duration;
/// Responsible for registering w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/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: IoDriver) -> io::Result<Self> {
// NB: We give each driver a "fresh" reciever file descriptor to avoid
// the issues described in alexcrichton/tokio-proc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/signal/unix/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:3 | // Check if the pipe is ready to read and therefore has "woken" us up
match self.registration.take_read_ready() {
Ok(Some(ready)) => assert!(ready.is_readable()),
Ok(None) => return, // No wake has arrived, bail
Err(e) => panic!("reactor gone: {}", e),
}
// D... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/signal/unix/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/unix/driver.rs:4 | fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> {
self.park.park_timeout(duration)?;
self.process();
Ok(())
}
fn shutdown(&mut self) {
self.park.shutdown()
}
}
// ===== impl Handle =====
impl Handle {
/// Returns a handle to the current driver... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/unix/driver.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/signal/unix/driver.rs | 121 | 153 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and allows receiving "ctrl-c"
//! and "ctrl-break" notifications. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_EVENT`.
#![cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | _ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_break);
}
}
#[derive(Debug)]
pub(crate) struct OsExtraData {}
impl Init for OsExtraData {
fn init() -> Self {
Self {}
}
}
/// Strea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let rx = globals().register_listener(signum as EventId);
Ok(Self {
inner: RxFuture::new(rx),
})
}
}
fn global_init() -> io::Result<()> {
static INIT: Once = Once::new();
let mut init ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | if globals.broadcast() {
TRUE
} else {
// No one is listening for this notification any more
// let the OS fire the next (possibly the default) handler.
FALSE
}
}
/// Creates a new stream which receives "ctrl-c" notifications sent to the
/// process.
///
/// # Examples
///
/// `... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:8 | /// use std::task::{Context, Poll};
/// use tokio::signal::windows::CtrlBreak;
///
/// struct MyFuture {
/// ctrl_break: CtrlBreak,
/// }
///
/// impl Future for MyFuture {
/// type Output = Option<()>;
///
/// fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/signal/windows.rs:9 | /// ```
pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
#[test]
fn ctrl_c() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 321 | 375 |
tokio-rs/tokio:tokio/src/signal/windows.rs:10 | // integration and test that our handling works.
unsafe {
super::handler(CTRL_BREAK_EVENT);
}
ctrl_break.recv().await.unwrap();
});
}
fn rt() -> Runtime {
crate::runtime::Builder::new_current_thread()
.build()
.unwrap(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/signal/windows.rs | 361 | 375 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and allows receiving "ctrl-c"
//! and "ctrl-break" notifications. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_EVENT`.
#![cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | _ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_break);
}
}
#[derive(Debug)]
pub(crate) struct OsExtraData {}
impl Init for OsExtraData {
fn init() -> Self {
Self {}
}
}
/// Strea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let (tx, rx) = channel(1);
globals().register_listener(signum as EventId, tx);
Ok(Event { rx })
}
pub(crate) async fn recv(&mut self) -> Option<()> {
use crate::future::poll_fn;
poll_f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | // According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus we don't
// have the same restrictions as in Unix signal handlers, meaning we can
// go ahead and perform the broadcast here.
if globals.broadcast() {
TR... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:8 | ///
/// ```rust,no_run
/// use std::pin::Pin;
/// use std::future::Future;
/// use std::task::{Context, Poll};
/// use tokio::signal::windows::CtrlBreak;
///
/// struct MyFuture {
/// ctrl_break: CtrlBreak,
/// }
///
/// impl Future for MyFuture {
/// type Output ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/signal/windows.rs:9 | /// stream.recv().await;
/// println!("got signal CTRL-BREAK");
/// }
/// }
/// ```
pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 321 | 379 |
tokio-rs/tokio:tokio/src/signal/windows.rs:10 | let mut ctrl_break = assert_ok!(super::ctrl_break());
// 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::handl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/src/signal/windows.rs | 361 | 379 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | /// Polls to receive the next signal notification event, outside of an
/// `async` context.
///
/// `None` is returned if no more events can be received by this stream.
///
/// # Examples
///
/// Polling from a manually implemented future
///
/// ```rust,no_run
/// use std::pin::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 49129434198a96444bc0e9582a14062d3a46e93a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/49129434198a96444bc0e9582a14062d3a46e93a/tokio/src/signal/windows.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/signal/windows.rs:9 | self.poll_recv(cx)
}
}
}
/// Creates a new stream which receives "ctrl-break" notifications sent to the
/// process.
///
/// # Examples
///
/// ```rust,no_run
/// use tokio::signal::windows::ctrl_break;
///
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// // An inf... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 49129434198a96444bc0e9582a14062d3a46e93a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/49129434198a96444bc0e9582a14062d3a46e93a/tokio/src/signal/windows.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/signal/windows.rs:10 | let _enter = rt.enter();
let mut ctrl_c = task::spawn(crate::signal::ctrl_c());
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 h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 49129434198a96444bc0e9582a14062d3a46e93a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/49129434198a96444bc0e9582a14062d3a46e93a/tokio/src/signal/windows.rs | 361 | 400 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and contains the primary `Event` type
//! for receiving notifications of events. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | _ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_break);
}
}
#[derive(Debug)]
pub(crate) struct OsExtraData {}
impl Init for OsExtraData {
fn init() -> Self {
Self {}
}
}
/// Strea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | pub(crate) fn ctrl_c() -> io::Result<Event> {
Event::new(CTRL_C_EVENT)
}
impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let (tx, rx) = channel(1);
globals().register_listener(signum as EventId, tx);
Ok(Event { rx })
}
pub(crate) async fn recv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus we don't
// have the same restrictions ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | /// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// // An infinite stream of CTRL-BREAK events.
/// let mut stream = ctrl_break()?;
///
/// // Print whenever a CTRL-BREAK event is received
/// loop {
/// stream.recv().await;
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | /// println!("polling MyFuture");
/// self.ctrl_break.poll_recv(cx)
/// }
/// }
/// ```
pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.inner.rx.poll_recv(cx)
}
}
cfg_stream! {
impl crate::stream::Stream for CtrlBreak {
type I... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/signal/windows.rs:7 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use crate::stream::StreamExt;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 241 | 295 |
tokio-rs/tokio:tokio/src/signal/windows.rs:8 | // integration and test that our handling works.
unsafe {
super::handler(CTRL_BREAK_EVENT);
}
ctrl_break.next().await.unwrap();
});
}
fn rt() -> Runtime {
crate::runtime::Builder::new_current_thread()
.build()
.unwrap(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/signal/windows.rs | 281 | 295 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | /// println!("polling MyFuture");
/// self.ctrl_break.poll_recv(cx)
/// }
/// }
/// ```
pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.inner.rx.poll_recv(cx)
}
}
cfg_stream! {
impl crate::stream::Stream for CtrlBreak {
type I... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/windows.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/signal/windows.rs:7 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use crate::stream::StreamExt;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/windows.rs | 241 | 296 |
tokio-rs/tokio:tokio/src/signal/windows.rs:8 | // like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(CTRL_BREAK_EVENT);
}
ctrl_break.next().await.unwrap();
});
}
fn rt() -> Runtime {
crate::run... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/signal/windows.rs | 281 | 296 |
tokio-rs/tokio:tokio/src/signal/windows.rs:7 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use crate::stream::StreamExt;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | a1d0681cd2e581b1f6767126858d2f3d5d8992f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a1d0681cd2e581b1f6767126858d2f3d5d8992f5/tokio/src/signal/windows.rs | 241 | 297 |
tokio-rs/tokio:tokio/src/signal/windows.rs:8 | // like sending signals on Unix, so we'll stub out the actual OS
// integration and test that our handling works.
unsafe {
super::handler(CTRL_BREAK_EVENT);
}
ctrl_break.next().await.unwrap();
});
}
fn rt() -> Runtime {
crate::run... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | a1d0681cd2e581b1f6767126858d2f3d5d8992f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a1d0681cd2e581b1f6767126858d2f3d5d8992f5/tokio/src/signal/windows.rs | 281 | 297 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and contains the primary `Event` type
//! for receiving notifications of events. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d600ab9a8f37e9eff3fa8587069a816b65b6da0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:7 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use crate::stream::StreamExt;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | f9ddb93604a830d106475bd4c4cae436fafcc0da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/signal/windows.rs | 241 | 297 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus we don't
// have the same restrictions ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | /// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// // An infinite stream of CTRL-BREAK events.
/// let mut stream = ctrl_break()?;
///
/// // Print whenever a CTRL-BREAK event is received
/// loop {
/// stream.recv().await;
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/src/signal/windows.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | /// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// // An infinite stream of CTRL-BREAK events.
/// let mut stream = ctrl_break()?;
///
/// // Print whenever a CTRL-BREAK event is received
/// loop {
/// stream.recv().await;
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | aef434c089754051e4a10c0e618f46003f31d2dc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aef434c089754051e4a10c0e618f46003f31d2dc/tokio/src/signal/windows.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | /// println!("polling MyFuture");
/// self.ctrl_break.poll_recv(cx)
/// }
/// }
/// ```
pub fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.inner.rx.poll_recv(cx)
}
}
cfg_stream! {
impl futures_core::Stream for CtrlBreak {
type It... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | aef434c089754051e4a10c0e618f46003f31d2dc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aef434c089754051e4a10c0e618f46003f31d2dc/tokio/src/signal/windows.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/signal/windows.rs:7 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::runtime::Runtime;
use tokio_test::{assert_ok, assert_pending, assert_ready_ok, task};
use futures::stream::StreamExt;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | aef434c089754051e4a10c0e618f46003f31d2dc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aef434c089754051e4a10c0e618f46003f31d2dc/tokio/src/signal/windows.rs | 241 | 297 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | _ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_break);
}
}
#[derive(Debug)]
pub(crate) struct OsExtraData {}
impl Init for OsExtraData {
fn init() -> Self {
Self {}
}
}
/// Strea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | }
pub(crate) fn ctrl_c() -> io::Result<Event> {
Event::new(CTRL_C_EVENT)
}
impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let (tx, rx) = channel(1);
globals().register_listener(signum as EventId, tx);
Ok(Event { rx })
}
pub(crate) async fn r... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus we don't
// have the same restrictions ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | type Item = ();
fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.poll_recv(cx)
}
}
/// Creates a new stream which receives "ctrl-break" notifications sent to the
/// process.
///
/// This function binds to the default reactor.
pub fn ctrl_break() -> io:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/signal/windows.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | });
}
#[test]
fn ctrl_break() {
let mut rt = rt();
rt.block_on(async {
let mut ctrl_break = assert_ok!(super::ctrl_break());
// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/src/signal/windows.rs | 201 | 228 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | });
}
#[test]
fn ctrl_break() {
let mut rt = rt();
rt.block_on(async {
let mut ctrl_break = assert_ok!(super::ctrl_break());
// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/signal/windows.rs | 201 | 228 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and contains the primary `Event` type
//! for receiving notifications of events. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | Ok(CTRL_C_EVENT) => Some(&self.ctrl_c),
Ok(CTRL_BREAK_EVENT) => Some(&self.ctrl_break),
_ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_break);
}
}
#[derive(Debug)]
pub(crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | pub(crate) struct Event {
rx: Receiver<()>,
}
impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let (tx, rx) = channel(1);
globals().register_listener(signum as EventId, tx);
Ok(Event { rx })
}
}
pub(crate) fn ctrl_c() -> io::Result<Event> {
Eve... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | });
init.unwrap_or_else(|| Ok(()))
}
unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
impl Stream for CtrlBreak {
type Item = ();
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Pin::new(&mut self.inner)
.poll_next(cx)
.map(|item| item.map(|_| ()))
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | let mut rt = rt();
rt.block_on(async {
let ctrl_break = super::ctrl_break().expect("failed to create CtrlC");
// 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 te... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/src/signal/windows.rs | 201 | 223 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | });
init.unwrap_or_else(|| Ok(()))
}
unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked in a new thread, thus ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
impl Stream for CtrlBreak {
type Item = ();
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Pin::new(&mut self.inner)
.poll_next(cx)
.map(|item| item.map(|_| ()))
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/windows.rs | 161 | 216 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | let mut rt = Runtime::new().unwrap();
rt.block_on(async {
let ctrl_break = super::ctrl_break().expect("failed to create CtrlC");
// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out the actual OS
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/signal/windows.rs | 201 | 216 |
tokio-rs/tokio:tokio/src/signal/windows.rs:1 | //! Windows-specific types for signal handling.
//!
//! This module is only defined on Windows and contains the primary `Event` type
//! for receiving notifications of events. These events are listened for via the
//! `SetConsoleCtrlHandler` function which receives events of the type
//! `CTRL_C_EVENT` and `CTRL_BREAK_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows.rs:2 | match DWORD::try_from(id) {
Ok(CTRL_C_EVENT) => Some(&self.ctrl_c),
Ok(CTRL_BREAK_EVENT) => Some(&self.ctrl_break),
_ => None,
}
}
fn for_each<'a, F>(&'a self, mut f: F)
where
F: FnMut(&'a EventInfo),
{
f(&self.ctrl_c);
f(&self.ctrl_br... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows.rs:3 | #[derive(Debug)]
pub(crate) struct Event {
rx: Receiver<()>,
}
impl Event {
fn new(signum: DWORD) -> io::Result<Self> {
global_init()?;
let (tx, rx) = channel(1);
globals().register_listener(signum as EventId, tx);
Ok(Event { rx })
}
}
pub(crate) fn ctrl_c() -> io::Result... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/signal/windows.rs:4 | init = Some(ret);
});
init.unwrap_or_else(|| Ok(()))
}
unsafe extern "system" fn handler(ty: DWORD) -> BOOL {
let globals = globals();
globals.record_event(ty as EventId);
// According to https://docs.microsoft.com/en-us/windows/console/handlerroutine
// the handler routine is always invoked ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/signal/windows.rs:5 | pub fn ctrl_break() -> io::Result<CtrlBreak> {
Event::new(CTRL_BREAK_EVENT).map(|inner| CtrlBreak { inner })
}
impl Stream for CtrlBreak {
type Item = ();
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
Pin::new(&mut self.inner)
.poll_next(cx)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 161 | 217 |
tokio-rs/tokio:tokio/src/signal/windows.rs:6 | fn ctrl_break() {
let mut rt = Runtime::new().unwrap();
rt.block_on(async {
let ctrl_break = super::ctrl_break().expect("failed to create CtrlC");
// Windows doesn't have a good programmatic way of sending events
// like sending signals on Unix, so we'll stub out th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows.rs | MIT | 7eb264a0d0ee68433b20ecafabed53a70a9d43a4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7eb264a0d0ee68433b20ecafabed53a70a9d43a4/tokio/src/signal/windows.rs | 201 | 217 |
tokio-rs/tokio:tokio/src/signal/windows/stub.rs:1 | //! Stub implementations for the platform API so that rustdoc can build linkable
//! documentation on non-windows platforms.
use crate::signal::RxFuture;
use std::io;
pub(super) fn ctrl_break() -> io::Result<RxFuture> {
panic!()
}
pub(super) fn ctrl_close() -> io::Result<RxFuture> {
panic!()
}
pub(super) fn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows/stub.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/stub.rs | 1 | 25 |
tokio-rs/tokio:tokio/src/signal/windows/stub.rs:1 | //! Stub implementations for the platform API so that rustdoc can build linkable
//! documentation on non-windows platforms.
use crate::signal::RxFuture;
use std::io;
pub(super) fn ctrl_c() -> io::Result<RxFuture> {
panic!()
}
pub(super) fn ctrl_break() -> io::Result<RxFuture> {
panic!()
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows/stub.rs | MIT | 69a6585429d17701a87aa914500d9c11e88c663f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69a6585429d17701a87aa914500d9c11e88c663f/tokio/src/signal/windows/stub.rs | 1 | 13 |
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:1 | use std::io;
use std::sync::OnceLock;
use crate::signal::RxFuture;
use crate::sync::watch;
use windows_sys::core::BOOL;
use windows_sys::Win32::System::Console as console;
type EventInfo = watch::Sender<()>;
pub(super) fn ctrl_break() -> io::Result<RxFuture> {
new(®istry().ctrl_break)
}
pub(super) fn ctrl_c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows/sys.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:2 | // the handler function.
//
// For more information, see:
// https://learn.microsoft.com/en-us/windows/console/handlerroutine#remarks
matches!(
signum,
console::CTRL_CLOSE_EVENT | console::CTRL_LOGOFF_EVENT | console::CTRL_SHUTDOWN_EVENT
)
}
#[derive(Debug, Default)]
struct Registry... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows/sys.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/signal/windows/sys.rs:3 | INIT.get_or_init(|| {
let rc = unsafe { console::SetConsoleCtrlHandler(Some(handler), 1) };
if rc == 0 {
Err(io::Error::last_os_error().raw_os_error())
} else {
Ok(())
}
})
.map_err(|e| {
e.map_or_else(
|| io::Error::new(io::ErrorKind::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/signal/windows/sys.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/signal/windows/sys.rs | 81 | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.