This commit is contained in:
2023-03-22 16:03:42 +01:00
parent 70b475b290
commit 962ee7180e
6 changed files with 68 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
void sig_handler(int signo)
{
printf("in handler\n");
}
int main()
{
signal(SIGALRM, sig_handler);
alarm(5);
for (size_t i = 0; i < 30; i++)
{
printf("i = %d, In main\n", i);
sleep(1);
}
return 0;
}