# [−]Module actix_web::actix::actix::dev::actors::signal

An actor implementation of Unix signal handling

This module implements asynchronous signal handling for Actix. For each signal `ProcessSignals` actor sends `Signal` message to all subscriber. To subscriber, send `Subscribe` message to `ProcessSignals` actor.

# Examples

    use actix::actors::signal;
    use actix::prelude::*;

    struct Signals;

    impl Actor for Signals {
        type Context = Context<Self>;
    }

    // Shutdown system on and of `SIGINT`, `SIGTERM`, `SIGQUIT` signals
    impl Handler<signal::Signal> for Signals {
        type Result = ();

        fn handle(&mut self, msg: signal::Signal, _: &mut Context<Self>) {
            match msg.0 {
                signal::SignalType::Int => {
                    println!("SIGINT received, exiting");
                    System::current().stop();
                }
                signal::SignalType::Hup => {
                    println!("SIGHUP received, reloading");
                }
                signal::SignalType::Term => {
                    println!("SIGTERM received, stopping");
                    System::current().stop();
                }
                signal::SignalType::Quit => {
                    println!("SIGQUIT received, exiting");
                    System::current().stop();
                }
                _ => (),
            }
        }
    }

    fn main() {
        // initialize system
        System::run(|| {
            // Start signals handler
            let addr = Signals.start();

            // send SIGTERM
            std::thread::spawn(move || {
                // emulate SIGNTERM
                addr.do_send(signal::Signal(signal::SignalType::Term));
            });
        });

        std::process::exit(0);
    }

## Structs

DefaultSignalsHandler | Default signals handler. This actor sends `SystemExit` message to `System` actor for each of `SIGINT`, `SIGTERM`, `SIGQUIT` signals.
ProcessSignals | An actor implementation of Unix signal handling
Signal | Process signal message
Subscribe | Subscribe to process signals.

## Enums

SignalType | Different types of process signals

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)