I'm starting to learn signals and how to trigger them. I have this simple code that triggers a signal using SIGUSR1, but when I run the code, the only thing that gets printed is the "Starting..." line. Nothing else gets printed. Am I doing something wrong?
#include <signal.h>
#include <stdio.h>
void my_handler(int signum)
{
printf("Hello\n");
printf("%d\n", signum);
if (signum == SIGUSR1) {
printf("Receveid\n");
}
}
int main() {
printf("Starting...\n");
signal(SIGUSR1, my_handler);
return 0;
}