my threaded program hangs after calling Queue.join()

Babu babukk at gmail.com
Tue Apr 6 15:43:12 CEST 2010


On Apr 6, 9:32 pm, Peter Otten <__pete... at web.de> wrote:
> Babu wrote:
> > I am not an expert in python, so any help is my appreciated.  My
> > threaded program consumed everything in the queue but is not
> > exiting... What is the problem with this program?
>
> Perhaps it's waiting for the task_done() call associated to the (None, None)
> pairs.
>
> >                         if host is None:
>
>                                   Q_in.task_done()
>
> >                                 break # reached end of queue
>
> The same problem could occur when an exception is raised.
>
> Peter

Thank you Kushal and Peter.  I have modified my program and added the
task_done() for end of queue and exceptions.  It works great now!



More information about the Python-list mailing list