Threads
Alex Martelli
aleax at mac.com
Fri May 12 01:59:53 EDT 2006
Peter Otten <__peter__ at web.de> wrote:
> placid wrote:
>
> > I have a thread that has a job Queue, it continuosly polls this queue
> > to see if there are any jobs for it, what i really wont to be able to
> > do is, when the queue is empty, i want the thread to pause (or more
> > technical, i want the thread to block) until the queue gets populated
> > again. Is this possible ?
>
> Isn't that the default behaviour of Queue.get()?
Absolutely! placid, just call the get method of that Queue instance: if
the queue is empty your thread DOES pause, or block, until there's some
item put on the queue by another thread.
Alex
More information about the Python-list
mailing list