Author mnewman
Recipients georg.brandl, jnoller, mnewman
Date 2009-07-04.15:48:44
SpamBayes Score 1.56682e-06
Marked as misclassified No
Message-id <1246722526.19.0.144079684692.issue6417@psf.upfronthosting.co.za>
In-reply-to
Content
# 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()
History
Date User Action Args
2009-07-04 15:48:46mnewmansetrecipients: + mnewman, georg.brandl, jnoller
2009-07-04 15:48:46mnewmansetmessageid: <1246722526.19.0.144079684692.issue6417@psf.upfronthosting.co.za>
2009-07-04 15:48:45mnewmanlinkissue6417 messages
2009-07-04 15:48:44mnewmancreate