Created
January 10, 2018 13:43
-
-
Save dulek/e14f3bb10998477a58289f95d0edae9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import time | |
def foo(d, manager): | |
q = manager.Queue() | |
q.put('test') | |
d[0] = q | |
def bar(d, manager): | |
while 0 not in d: | |
time.sleep(1) | |
print d[0].get() | |
manager = multiprocessing.Manager() | |
d = manager.dict() | |
p = multiprocessing.Process(target=foo, args=(d, manager)) | |
p2 = multiprocessing.Process(target=bar, args=(d, manager)) | |
p.start() | |
p2.start() | |
p.join() | |
p2.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment