Skip to content

Instantly share code, notes, and snippets.

@lextoumbourou
Last active December 29, 2015 05:29
Show Gist options
  • Save lextoumbourou/7622016 to your computer and use it in GitHub Desktop.
Save lextoumbourou/7622016 to your computer and use it in GitHub Desktop.
from os import fork, getppid, wait
from sys import exit
from time import sleep
pid = fork()
if pid == 0:
print "Hope my parent doesn't forget me this time!"
for _ in range(3):
sleep(1)
print "Right now, my parent is", getppid()
else:
wait()
print "My child has finished processing. My work here is done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment