Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rdemeter
GitHub Repository: rdemeter/so
Path: blob/master/lab6/sigint.c
221 views
1
#include <stdio.h>
2
#include <string.h>
3
#include <unistd.h>
4
#include <stdlib.h>
5
#include <signal.h>
6
7
static void sighandler(int signum) {
8
/* actions that should be taken when the signal signum is received */
9
printf(" Caught signal %d\n", signum);
10
11
//exit(1);
12
}
13
14
int main(void) {
15
signal(SIGINT, sighandler);
16
17
while(1) {
18
printf("Going to sleep for a second...\n");
19
sleep(1);
20
}
21
return 0;
22
}
23
24