Comments (5)
Confirmed, this is a show-stopper problem. We need WINCH
and it should work. If it cannot catch these signals, it should not compile, but it should also be fixed. Silently broken is unprofessional fail.
@agatan Obviously, if you bothered to read the man pages, a correct call to pthread_sigmask
is needed. A catchable signal must be not blocked, not ignored and have a registered handler to deliver it to.
from chan-signal.
I just ran into this as well. I don't understand, is this something that is fixable given the current architecture of the crate? I could try and open a PR.
from chan-signal.
Just run into this too. I think you are both right. You need to set the signals to be "blocked" and also not "ignored.
From man sigwait
:
The signals specified by set should be blocked, but not ignored, at the time of the call to sigwait().
Processes which call sigwait() on ignored signals will wait indefinitely. Ignored signals are dropped immediately by the system, before delivery to a waiting process.
From man sigaction
:
A process may specify a handler to which a signal is delivered, or specify that a signal is to be ignored.
From man pthread_sigmask
:
Actually these man pages are about the most confusingly written I have ever read, but pthread_sigmask
lets you set the "block" bit on a signal.
It would be good if this crate's Readme.md
would mention that it doesn't... really.. work :-/
from chan-signal.
And upon reading the code it seems like it does block the signals properly, but just doesn't set any signal handlers.
A workaround in your code is something like this:
extern crate libc;
use libc::sighandler_t;
use libc::{c_int, c_void, SIGWINCH};
use libc::signal;
extern fn handler(_: c_int) {}
fn get_handler() -> sighandler_t {
handler as extern fn(c_int) as *mut c_void as sighandler_t
}
fn main() {
unsafe { signal(SIGWINCH, get_handler()); }
...
I have verified that this works and I now receive SIGNWINCH
, however this should really be fixed in the library by doing the above for any signals the user requests.
from chan-signal.
This crate is now deprecated. See: https://users.rust-lang.org/t/ann-chan-is-deprecated-use-crossbeam-channel-instead/19251
from chan-signal.
Related Issues (14)
- Windows support HOT 6
- Using chan_signal::notify masks all signals HOT 2
- Add SIGWINCH HOT 2
- Allow Setting signals to default handling as well as ignoring them HOT 2
- Strange (?) interaction with SIGINT, cargo run, and stdin HOT 4
- Alternative APIs HOT 6
- Mac doesn't seem to close properly on any signal HOT 2
- Using longer constant names? HOT 4
- doesn't seem to work with `fork()` HOT 7
- API for waiting on any signal HOT 1
- Please export Signal::as_sig
- Documentation offline? HOT 1
- Drop Trait blocked for variables given to the worker thread HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chan-signal.