Last active
June 14, 2021 13:04
-
-
Save nick87720z/1d3efc7280d130b71ceb55398b93a0c8 to your computer and use it in GitHub Desktop.
Testing, how signals are handled when not blocked for handler execution time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <signal.h> | |
void action_usr1 (int sig) | |
{ | |
sleep (3); | |
puts ("usr1"); | |
fflush (stdout); | |
} | |
struct sigaction act = { | |
.sa_handler = action_usr1, | |
.sa_flags = SA_NODEFER | |
}; | |
int main (int argc, char ** argv) | |
{ | |
sigaction (SIGUSR1, & act, NULL); | |
puts ("oh, hello"); | |
while (1) | |
sleep (1); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment