This piece of code (written in Python) has probably been written many times, by many people, but then again, it's useful.
import os
def myfork(thing):
"""myfork(thing) executes thing() in a separate thread"""
pid = os.fork()
if not pid:
#We're in the child thread now.
thing()
exit()
else:
#Parent thread.
return pidAs
(
Read more... )