On 2015-06-13 11:38, jaivish kothari wrote:
Hi ,

    I had a Question,i hope i'll find the solution here.

Say i have a Queue.
  >>> h = Queue.Queue(maxsize=0)
 >>> h.put(1)
 >>> h.put(2)
 >>> h.empty()
False
 >>> h.join()
 >>> h.empty()
False
 >>> h.get()
1
 >>> h.get()
2
 >>> h.get()
Blocked.......................

My Question is :
In a single threaded environment why does the get() gets blocked ,
instead of raising an exception.On interpreter i have no way to resume
working.

And my second question is :
Why doe we have to explicitly call task_done after get(). why doesn't
get() implicitly call task_done().
as for put() entry for unfinished_task is automatically added .why not
get deleted in get() then.

The way it's used is to get a item, process it, and then signal that it
has finished with it. There's going to be a period of time when an item
is not in the queue, but is still being processed.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to