Message75172
http://docs.python.org/dev/3.0/library/multiprocessing.html
I'm sure the examples have been thoughtfully contrived. Still, this
seems instructive without adding much complexity. I'd change the
first "trivial example" to
###########################################
from multiprocessing import Process
import os
def info(title):
print(title)
print('module name:',__name__)
print('parent process:',os.getppid())
print('process id:',os.getpid())
print()
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()
###########################################
with output similar to
main line
module name: __main__
parent process: 12926
process id: 17002
function f
module name: __main__
parent process: 17002
process id: 17004
hello bob |
|
Date |
User |
Action |
Args |
2008-10-24 16:54:37 | LambertDW | set | recipients:
+ LambertDW, georg.brandl |
2008-10-24 16:54:37 | LambertDW | set | messageid: <1224867277.0.0.802822144442.issue4193@psf.upfronthosting.co.za> |
2008-10-24 16:54:36 | LambertDW | link | issue4193 messages |
2008-10-24 16:54:35 | LambertDW | create | |
|