mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
signal: change unix::Signal to return () instead of signum (#1330)
* This simplifies the API surface by returning () instead of the signal number that was used during registration. This also more closely mirrors the cross-platform `CtrlC` event stream API * This is a **breaking change**
This commit is contained in:
@@ -11,8 +11,8 @@ mod platform {
|
||||
|
||||
pub async fn main() {
|
||||
// Create a stream for each of the signals we'd like to handle.
|
||||
let sigint = Signal::new(SIGINT).await.unwrap();
|
||||
let sigterm = Signal::new(SIGTERM).await.unwrap();
|
||||
let sigint = Signal::new(SIGINT).await.unwrap().map(|_| SIGINT);
|
||||
let sigterm = Signal::new(SIGTERM).await.unwrap().map(|_| SIGTERM);
|
||||
|
||||
// Use the `select` combinator to merge these two streams into one
|
||||
let stream = stream::select(sigint, sigterm);
|
||||
|
||||
Reference in New Issue
Block a user