Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void spawnChildren( unsigned int n )
- {
- /* avoid 'unused parameter' warning */
- (void)n;
- for (unsigned int i = 0; i < n; ++i) {
- int pid = fork();
- if (pid == 0) {
- printf("%d\n", getpid());
- break;
- }
- else
- printf("I am the parent process of: %d\n", pid);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement