{"id":20696975,"url":"https://github.com/smol-rs/async-signal","last_synced_at":"2026-04-07T13:02:30.986Z","repository":{"id":65763340,"uuid":"597226724","full_name":"smol-rs/async-signal","owner":"smol-rs","description":"Asynchronous signal handling","archived":false,"fork":false,"pushed_at":"2026-01-20T14:50:02.000Z","size":79,"stargazers_count":25,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-20T22:00:19.419Z","etag":null,"topics":["async","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smol-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-03T23:03:30.000Z","updated_at":"2026-01-20T14:50:19.000Z","dependencies_parsed_at":"2025-02-12T14:08:41.154Z","dependency_job_id":"36aa064e-3575-42ee-9482-876b7168e6e2","html_url":"https://github.com/smol-rs/async-signal","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/smol-rs/async-signal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-signal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-signal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-signal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-signal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smol-rs","download_url":"https://codeload.github.com/smol-rs/async-signal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-signal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31513382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","rust"],"created_at":"2024-11-17T00:16:14.461Z","updated_at":"2026-04-07T13:02:30.958Z","avatar_url":"https://github.com/smol-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async-signal\n\n[![Build](https://github.com/smol-rs/async-signal/workflows/Build%20and%20test/badge.svg)](\nhttps://github.com/smol-rs/async-signal/actions)\n[![License](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue.svg)](\nhttps://github.com/smol-rs/async-signal)\n[![Cargo](https://img.shields.io/crates/v/async-signal.svg)](\nhttps://crates.io/crates/async-signal)\n[![Documentation](https://docs.rs/async-signal/badge.svg)](\nhttps://docs.rs/async-signal)\n\nAsynchronous signal handling.\n \nThis crate provides the [`Signals`] type, which can be used to listen for POSIX signals asynchronously. It can be seen as an asynchronous version of [`signal_hook::iterator::Signals`].\n\n[`Signals`]: https://docs.rs/async-signal/latest/async_signal/struct.Signals.html\n[`signal_hook::iterator::Signals`]: https://docs.rs/signal-hook/latest/signal_hook/iterator/struct.Signals.html\n\n# Implementation\n\nOn `unix`, this crate uses the [`signal_hook_registry`] crate to register a listener for each signal. That listener will then send a message through a Unix socket to the [`Signals`] type, which will receive it and notify the user. Asynchronous notification is done through the [`async-io`] crate.\n\nNote that the internal pipe has a limited capacity. Once it has reached capacity, additional signals will be dropped.\n\nOn Windows, a different implementation that only supports `SIGINT` is used. This implementation uses a channel to notify the user.\n\n[`signal_hook_registry`]: https://crates.io/crates/signal-hook-registry\n[`async-io`]: https://crates.io/crates/async-io\n\n# Examples\n\n```rust\nuse async_signal::{Signal, Signals};\nuse futures_lite::prelude::*;\nuse signal_hook::low_level;\n\n// Register the signals we want to receive.\nlet mut signals = Signals::new([\n    Signal::Term,\n    Signal::Quit,\n    Signal::Int,\n])?;\n\n// Wait for a signal to be received.\nwhile let Some(signal) = signals.next().await {\n    // Print the signal.\n    eprintln!(\"Received signal {:?}\", signal);\n\n    // After printing it, do whatever the signal was supposed to do in the first place.\n    low_level::emulate_default_handler(signal.unwrap() as i32).unwrap();\n}\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n#### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmol-rs%2Fasync-signal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmol-rs%2Fasync-signal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmol-rs%2Fasync-signal/lists"}