Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by duped

6 days ago

Yes, this is easy to test too:

    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    int main() {
        pid_t pid = fork();
        if (pid == 0) {
            sleep(1);
            printf("after parent died!\n");
            return 0;
        }
        return 0;
    }

You'll see the message printed out 1 second after the process ends.

0 comments

duped

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities