求助
麻烦高手给我看一下以下程序,如何修改才能在VC下成功运行
#include<stdio.h>
#include<signal.h>
#include<unistd.h>
void waiting(),stop();
int wait_mark;
main()
{
int p1,p2;
if(p1=fork()) /*创建子进程p1*/
{
if(p2=fork()) /*创建子进程p2*/
{
wait_mark=1;
signal(SIGINT,stop); /*接收到^c信号,转stop*/
waiting();
kill(p1,02); /*向p1发软中断信号02*/
kill(p2,02); /*向p2发软中断信号02*/
wait(0); /*等待子进程1结束的信号*/
wait(0); /*等待子进程2结束的信号*/
printf("parent process is killed!\n");
exit(0); /*父进程结束*/
}
else
{
wait_mark=1;
signal(SIGINT,stop); /*等待进程2被杀死的中断号02*/
waiting();
lockf(1,0,0);
printf("child process2 is killed by parent!\n");
lockf(1,0,0);
exit(0);
}
}
else
{
wait_mark=1;
signal(SIGINT,stop); /*等待进程1被杀死的中断号02*/
waiting();
lockf(1,0,0);
printf("child process1 is killed by parent!\n");
lockf(1,0,0);
exit(0);
}
}
void waiting()
{
while(wait_matk!=0);
}
void stop( )
{
while(wait_mark=0);
}