25 lines
400 B
Python
Executable File
25 lines
400 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
from multiprocessing import Process, Lock
|
|
|
|
def f(l, i, d):
|
|
d['a'] = 'shutup'
|
|
print 'hello world', i, d
|
|
j = 0.0
|
|
for i in xrange(10000000):
|
|
j = j + j/2.0
|
|
|
|
if __name__ == '__main__':
|
|
lock = Lock()
|
|
|
|
d = {'a': 1, 'b': 2}
|
|
|
|
ps = []
|
|
for num in range(2):
|
|
ps.append(Process(target=f, args=(lock, num, d)))
|
|
|
|
for p in ps: p.start()
|
|
for p in ps: p.join()
|
|
|
|
print d
|