Michael Newman <michael.b.new...@gmail.com> added the comment:

# Revised example that is more platform neutral (avoids sys.platform):

from multiprocessing import Process, current_process
import os

def info(title):
    print(title)
    print('module name:', __name__)
    if not hasattr(os, 'getppid'):  # win32
      print('parent process:', current_process()._parent_pid)
    else:
      print('parent process:', os.getppid())
    print('process id:', os.getpid())

def f(name):
    info('function f')
    print('hello', name)

if __name__ == '__main__':
    info('main line')
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6417>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to