smol-rs / async-signal Goto Github PK
View Code? Open in Web Editor NEWAsynchronous signal handling
License: Apache License 2.0
Asynchronous signal handling
License: Apache License 2.0
Our Cargo.toml currently has the following categories:
Line 11 in b74019f
However, on crates.io page, the category corresponding to "signal-handling" is not shown.
https://crates.io/crates/async-signal
Windows supports signals as well (albeit a significantly smaller set than what Unix supports). It would be good to support those signals here.
However, the current notification (an asynchronous pipe) isn't supported by async-io
yet. We could either use Windows UDS sockets, which would work out of the box in this case but aren't available on older versions of Windows, or we could work named pipes into async-io
/polling
, which would be harder but also open up more opportunities.
Hi, thanks for making this neat crate!
While reading the source code, I found that it is using a socket pair as the notifier, I am curious why not use a channel, like Tokio does. Thanks!
kqueue
supports EVFILT_SIGNAL
, which would allow us to wait on a signal without needing to use a pipe. I'm working on exposing this functionality in async-io
via smol-rs/async-io#112. However, this would require setting up an executor to listen for signals.
Right now, when a signal is registered via the Signals
type, the default signal handler is disabled. This requires the user to manually call the low-level signal handler. This is probably what's desired for most cases, like handling SIGINT
, since the default signal handler for SIGINT
ends the application. However, for other signals, it may be desired to call the default signal handler. I think there should be an option in add_signals
or other to call the default signal handler on receipt.
I'm looking into packaging this crate for Fedora Linux as a new dependency of the async-process crate. Currently this crate does not include any license texts, but both the MIT and the Apache-2.0 license require that (re)distributed sources contain a copy of the license text. This is a problem from a distribution point of view, and blocks work on providing a package for this crate (and updating async-process to the latest versions).
I realized v0.2.0 of this crate a little over a year ago. Since then it has not had any breaking public API changes. It's used in production via async-process
and we've only ever gotten one bug report with it (the now-removed signalfd backend).
So, I think this crate is stable and can be released as version 1.0.0. Are there any API changes I should make before releasing the stable version of this crate publicly?
cc @smol-rs/admins
Linux supports signalfd
, which can be used to wait for signals in epoll
without needing to clone several pipes like we do in the current implementation. On Linux, we should use that instead.
concurrent-queue
is imported (in Cargo.toml) only if target is linux
, but is used when target is linux
OR android
.
So, async-signal last release (v0.2.1) does not build on android
target.
Thank you !
Cargo.toml
[target.'cfg(target_os = "linux")'.dependencies]
concurrent-queue = "2.2.0"
lib.rs
} else if #[cfg(any(target_os = "android", target_os = "linux"))] {
mod signalfd;
use signalfd as sys;
}
signalfd.rs
use concurrent_queue::ConcurrentQueue;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.