Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent process can not be waked when vfork() a second process #187

Open
suarez12138 opened this issue May 28, 2021 · 0 comments
Open

Parent process can not be waked when vfork() a second process #187

suarez12138 opened this issue May 28, 2021 · 0 comments

Comments

@suarez12138
Copy link

Hey bros, I am troubled by the waker.

int main(void){
   int pid1 = vfork();
   if (pid1) {
        printf("Process %d try to do something more! \n",pid1);
        int pid2 = vfork();
        if (pid2) {
            printf("Process %d try to do something! \n",pid2);
	}else{
      	    execl("/bin/dosomething", "/bin/dosomething", NULL);
	}
    }else{
        execl("/bin/domorething", "/bin/domorething", NULL);
    }
    return 0;
}

For the above case that parent process first vfork one child, when the child start to execute domorething, the parent successfully awake and leave vfork(). But when the parent process vfork the second child process and child process also start to execute something, it seems that the parent process can not be awaked by the code bellow and go into poll method. So the parent process can not timely leave vfork(). Do you have some ideas about the waker?

waker.wake_by_ref();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant