Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 19, 2015 00:26
Show Gist options
  • Save lettergram/990312e930796eb364ac to your computer and use it in GitHub Desktop.
Save lettergram/990312e930796eb364ac to your computer and use it in GitHub Desktop.
/**
* Given the file descriptor this function,
* writes A, waits 2 second, writes "c,"
*/
void child_one_func(int fd){
write(fd, "A - 1", 5);
sleep(2);
write(fd, "C - 3", 5);
close(fd);
}
/**
* Given the file descriptor this function,
* Waits 1 second, writes "B", Waits 2 seconds,
* then writes "D"
*/
void child_two_func(int fd){
sleep(1);
write(fd, "B - 2", 5);
sleep(2);
write(fd, "D - 4", 5);
close(fd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment