The usual raise?
pickfire opened this issue · comments
I was looking to send a signal to itself. Like kill(0, SIGTSTP)
but I came across raise which I think may do the same thing, or does it?
In the docs https://docs.rs/signal-hook/0.3.9/signal_hook/low_level/fn.raise.html
The usual raise, just the safe wrapper around it.
What does "the usual raise" means? Is it kill?
I tried using it instead of kill(0, SIGTSTP)
and it seemed to work. I think the docs around this needs some update, maybe it can say it sends the kill signal to itself?
Raise is a standard posix function, see https://linux.die.net/man/3/raise (you can check the internal implementation too ‒ docs.rs has these very handy [src]
buttons). That's what I mean by „usual“. You're welcome to propose a more specific wording, as usual
is a bit informal/vague.
I'd like to point out that this is not equivalent to kill(0, ...)
, which says „If pid equals 0, then sig is sent to every process in the process group of the calling process.“, while raise targets only the calling process/thread. Furthermore, raise
is synchronous and waits for the signal handler to terminate before returning, while kill
only „posts“ the signal and doesn't wait. These are subtle differences, but the whole posix is mostly built around subtleties, therefore the similarity is only the first approximation.