Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocessing import Process
- import time
- def f(queue):
- queue.insert(0, [42, None, 'hello']) # queue.push()
- if __name__ == '__main__':
- queue = [] # using list as queue
- p = Process(target=f, args=(queue,))
- p.start()
- # get value from the child
- while True:
- try:
- val = queue.pop()
- break
- except IndexError: # queue is empty
- time.sleep(0.1)
- print(val) # never reached!
- p.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement