Linux WaitForSingleObject?

我与影子孤独终老i 提交于 2019-12-02 17:51:18

问题


Here a piece of code showing the problem

//main

Process* process = NULL;
while(!process) {
    cout<<endl<<"Waiting for second process.\nPress any key";
    getchar();
    getchar();

    process = Process::takeExisting("process");
}
Process::waitEnd(process); //Problem here
cout<<endl<<"second process ended";

//Process::waitEnd

static void waitEnd(Process* proc) {
        int w = waitpid(proc->hProcess, &(proc->exitCode), WCONTINUED);
        Debug::error(errno," waitpid error - ");
    }

I've tried: stop first, wait second ends, continue first.

The problem: the second process is not child( I run it from second console ) so with this code errno is equal to 10. How to solve this on Linux?

来源:https://stackoverflow.com/questions/38002930/linux-waitforsingleobject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!