Created
May 14, 2016 22:02
-
-
Save bitjockey42/8731617c1a62e680a63664e4f140263c to your computer and use it in GitHub Desktop.
This file contains 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
// System | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <pwd.h> | |
#include <assert.h> | |
#include <errno.h> | |
#include <uuid/uuid.h> | |
int main() | |
{ | |
pid_t child1, child2; | |
if ((child1 = fork()) == 0) { | |
if ((child2 = fork()) == 0) { | |
printf("This is the second child!\n"); | |
sleep(2); | |
} else { | |
wait(NULL); | |
printf("This should be the first child.\n"); | |
} | |
} else { | |
wait(NULL); | |
printf("This is the parent\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment