diff options
[SP/P08] Solved exercises
1 files changed, 23 insertions, 0 deletions
| -rw-r--r-- | Year 3/System programming/Practice08/ex3.c | 23 |
diff --git a/Year 3/System programming/Practice08/ex3.c b/Year 3/System programming/Practice08/ex3.c new file mode 100644 index 0000000..6dafe40 --- /dev/null +++ b/Year 3/System programming/Practice08/ex3.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <signal.h> +#include <sys/types.h> +#include <unistd.h> + +void usr1Handler(int a) { +} + +int main() { + signal(SIGUSR1, &usr1Handler); + + int fp = fork(); + if (fp == 0) { // child + printf("child\n"); + kill(getppid(), SIGUSR1); + } + else { + pause(); + printf("child finished\n"); + } + + return 0; +} |
