How to block signals in C?
问题 I'm trying to create a program that blocks the signal SIGUSR1 and the it unblocks the signal. In the middle I want to see that the signal is blocked using sigpending . But it always says that the signal isn't blocked, and I can use the signal when it's supposed to be blocked. This is the code that I have. #include <stdlib.h> #include <stdio.h> #include <signal.h> static void signals(int signaln) { switch (signaln) { case SIGUSR1: printf("Signal SIGUSR1\n"); break; } return; } main() { sigset