Message90121
# 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() |
|
Date |
User |
Action |
Args |
2009-07-04 15:48:46 | mnewman | set | recipients:
+ mnewman, georg.brandl, jnoller |
2009-07-04 15:48:46 | mnewman | set | messageid: <1246722526.19.0.144079684692.issue6417@psf.upfronthosting.co.za> |
2009-07-04 15:48:45 | mnewman | link | issue6417 messages |
2009-07-04 15:48:44 | mnewman | create | |
|