如何在C语言中使用等待联合

问题描述 投票:-1回答:1
union wait wstat;
        pid_t pid;

        while(1)
        {
            pid = wait3(&wstat,WNOHANG,(struct rusage *)NULL);
            if(pid == 0 )
                return;
            else if(pid == -1)
                return;
            else
            {
                fprintf(stderr,"\nProcess with PID : %d exited with return value: %d\n",pid,wstat.w_retcode);
                deleteJob(pid);
            }
        }

我正在尝试在unix shell上使用等待联合,但我无法使用它,因为我遇到了错误wait' isn't known warning: implicit declaration of functionwait3']的存储大小

工会等待wstat; pid_t pid; while(1){pid = wait3(&wstat,WNOHANG,(struct rusage *)NULL); if(pid == 0)返回;其他...

c linux posix ubuntu-18.04
1个回答
1
投票

您应添加以下包含文件:

© www.soinside.com 2019 - 2024. All rights reserved.