Skip to content

Instantly share code, notes, and snippets.

@nick87720z
Last active June 14, 2021 13:04
Show Gist options
  • Save nick87720z/1d3efc7280d130b71ceb55398b93a0c8 to your computer and use it in GitHub Desktop.
Save nick87720z/1d3efc7280d130b71ceb55398b93a0c8 to your computer and use it in GitHub Desktop.
Testing, how signals are handled when not blocked for handler execution time
#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