Created
April 23, 2021 05:46
-
-
Save alsamitech/130cffc3e0891b0208a4f16d20f9360a to your computer and use it in GitHub Desktop.
Executes another program with a child process received from fork. Instead of waiting, one process just returns the function and the program can just continue whatever it was doing originally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Requires <unistd.h> and <stdlib.h> | |
| void ExecuteAsync(char** argv){ | |
| pid_t pid=fork(); | |
| if(pid==0){ | |
| // child process | |
| execv(argv[0], argv); | |
| exit(127); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment