Skip to content Skip to sidebar Skip to footer

Python Queue Get()/task_done() Issue

My consumer side of the queue: m = queue.get() queue.task_done() Questions: Does task_done() effectively pops m off the queue and release whatever lo

Solution 1:

No, queue.get() pops the item off the queue. After you do that, you can do whatever you want with it, as long as the producer works like it should and doesn't touch it anymore. queue.task_done() is called only to notify the queue that you are done with something (it doesn't even know about the specific item, it just counts unfinished items in the queue), so that queue.join() knows the work is finished.


Post a Comment for "Python Queue Get()/task_done() Issue"