[−][src]Struct libuv::handles::signal::SignalHandle
Signal handles implement Unix style signal handling on a per-event loop bases.
Windows notes: Reception of some signals is emulated:
- SIGINT is normally delivered when the user presses CTRL+C. However, like on Unix, it is not generated when terminal raw mode is enabled.
- SIGBREAK is delivered when the user pressed CTRL + BREAK.
- SIGHUP is generated when the user closes the console window. On SIGHUP the program is given approximately 10 seconds to perform cleanup. After that Windows will unconditionally terminate it.
- SIGWINCH is raised whenever libuv detects that the console has been resized. When a libuv app is running under a console emulator, or when a 32-bit libuv app is running on 64-bit system, SIGWINCH will be emulated. In such cases SIGWINCH signals may not always be delivered in a timely manner. For a writable TtyHandle libuv will only detect size changes when the cursor is moved. When a readable TtyHandle is used, resizing of the console buffer will be detected only if the handle is in raw mode and is being read.
- Watchers for other signals can be successfully created, but these signals are never received. These signals are: SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM and SIGKILL.
- Calls to raise() or abort() to programmatically raise a signal are not detected by libuv; these will not trigger a signal watcher.
Unix notes
- SIGKILL and SIGSTOP are impossible to catch.
- Handling SIGBUS, SIGFPE, SIGILL or SIGSEGV via libuv results into undefined behavior.
- SIGABRT will not be caught by libuv if generated by abort(), e.g. through assert().
- On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them.
Implementations
impl SignalHandle
[src]
pub fn new(r#loop: &Loop) -> Result<SignalHandle>
[src]
Create and initialize a new signal handle
pub fn start<CB: Into<SignalCB<'static>>>(
&mut self,
cb: CB,
signum: i32
) -> Result<()>
[src]
&mut self,
cb: CB,
signum: i32
) -> Result<()>
Start the handle with the given callback, watching for the given signal.
pub fn start_oneshot<CB: Into<SignalCB<'static>>>(
&mut self,
cb: CB,
signum: i32
) -> Result<()>
[src]
&mut self,
cb: CB,
signum: i32
) -> Result<()>
Same functionality as start() but the signal handler is reset the moment the signal is received.
pub fn stop(&mut self) -> Result<()>
[src]
Stop the handle, the callback will no longer be called.
pub fn signum(&self) -> i32
[src]
Signal being monitored by this handle.
Trait Implementations
impl Clone for SignalHandle
[src]
fn clone(&self) -> SignalHandle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for SignalHandle
[src]
impl From<SignalHandle> for Handle
[src]
fn from(signal: SignalHandle) -> Handle
[src]
impl HandleTrait for SignalHandle
[src]
fn is_active(&self) -> bool
[src]
fn is_closing(&self) -> bool
[src]
fn close<CB: Into<CloseCB<'static>>>(&mut self, cb: CB)
[src]
fn ref(&mut self)
[src]
fn unref(&mut self)
[src]
fn has_ref(&self) -> bool
[src]
fn send_buffer_size(&mut self, value: i32) -> Result<i32>
[src]
fn recv_buffer_size(&mut self, value: i32) -> Result<i32>
[src]
fn get_fileno(&self) -> Result<OsFile>
[src]
fn get_loop(&self) -> Loop
[src]
fn get_type(&self) -> HandleType
[src]
impl ToHandle for SignalHandle
[src]
impl TryFrom<Handle> for SignalHandle
[src]
Auto Trait Implementations
impl RefUnwindSafe for SignalHandle
impl !Send for SignalHandle
impl !Sync for SignalHandle
impl Unpin for SignalHandle
impl UnwindSafe for SignalHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,