3 ms·
> For the rest, using sigwaitinfo or signalfd works just as well in Rust as in C/C++, but not really better or worse. There aren't any good libraries for it (wh
by scottlamb 10y ago
> For the rest, using sigwaitinfo or signalfd works just as well in Rust as in C/C++, but not really better or worse. There aren't any good libraries for it (which I keep meaning to do something about), but the underlying POSIX APIs are usable equally well in all three languages.
There are a couple crates which should suffice for basic SIGTERM/SIGHUP/SIGINT handling:
https://github.com/BurntSushi/chan-signal https://github.com/BurntSushi/chan-signal creates a sigwait thread which sends signals over a channel.
https://github.com/alexcrichton/tokio-signal https://github.com/alexcrichton/tokio-signal uses the self-pipe trick to integrate with a tokio event loop.