Results of my master's thesis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smp.py 400B

123456789101112131415161718192021222324
  1. #!/usr/bin/python
  2. from multiprocessing import Process, Lock
  3. def f(l, i, d):
  4. d['a'] = 'shutup'
  5. print 'hello world', i, d
  6. j = 0.0
  7. for i in xrange(10000000):
  8. j = j + j/2.0
  9. if __name__ == '__main__':
  10. lock = Lock()
  11. d = {'a': 1, 'b': 2}
  12. ps = []
  13. for num in range(2):
  14. ps.append(Process(target=f, args=(lock, num, d)))
  15. for p in ps: p.start()
  16. for p in ps: p.join()
  17. print d