#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
main(){
int ret_from_fork,mypid;
mypid = getpid();
printf("Before:my pid is %d\n",mypid);
ret_from_fork = fork();
sleep(1);
printf("After:my pid is %d,fork() said %d\n",
getpid(),ret_from_fork);
}
fork的示例
最新推荐文章于 2022-11-28 22:43:33 发布
本文详细解析了C语言中fork函数的工作原理,并通过示例展示了如何在实际编程中运用此函数进行进程创建。

2471

被折叠的 条评论
为什么被折叠?



