Skip to content

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

Open
@suarez12138

Description

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();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions