You're really close. See inline comment below.

On Fri, Mar 5, 2010 at 11:21 AM, wongjoek...@yahoo.com
<wongjoek...@yahoo.com> wrote:
>
> def c():
>    print "function c"
>
> def f(a,b, d):
>    # function I want to run in a new child process
>    print a, b
>    d()
>
> def g():
>    pidID = os.fork()
>    if pidID == 0:
>        # child do something here
>        f(2,3,c)

You'll need to exit here -- not return.
http://docs.python.org/library/os.html#os._exit

>    else:
>        # parent do something here
>        print "Parent
>
> for i in range(3):
>    g()
>

-- 
Jonathan Gardner
jgard...@jonathangardner.net
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to