jeudi 16 juin 2016

Cannot get data from Queue


I'm trying to use a joinable queue and i didn't get anything when join() is called on queue

from multiprocessing import JoinableQueue,Pool

q = JoinableQueue()

def pat(i):
    q.put("hello"+str(i))
    q.join()
    print(q.get())

with Pool(5) as  p:
    (p.map_async(pat,range(5))).get()

res = q.get()
print(res+"main")
q.task_done()

I get data from queue only after process exits

Can anyone help me with this


Aucun commentaire:

Enregistrer un commentaire