mirror of
https://github.com/riba2534/TCP-IP-NetworkNote.git
synced 2026-05-01 14:10:44 +08:00
P169 用 signal 函数进行信号处理
This commit is contained in:
23
ch10/zombie.c
Normal file
23
ch10/zombie.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user