P169 用 signal 函数进行信号处理

This commit is contained in:
riba2534
2019-01-20 21:08:23 +08:00
parent f62528d701
commit 9d447f635e
5 changed files with 456 additions and 1 deletions

23
ch10/zombie.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
pid_t pid = fork();
if (pid == 0)
{
puts("Hi, I am a child Process");
}
else
{
printf("Child Process ID: %d \n", pid);
sleep(30);
}
if (pid == 0)
puts("End child proess");
else
puts("End parent process");
return 0;
}