how does a queue stop the thread?

Kushal Kumaran kushal.kumaran+python at
Wed Apr 21 10:20:15 CEST 2010

On Wed, Apr 21, 2010 at 1:38 PM, kaiix <kvn.hou at> wrote:
> A simple thread pool example. My question is, since **
> will loop endless, how does the thread know the time to quit? how does
> the *queue* notify the thread? is there any shared variables, like a
> *lock*?
> When I set daemon false, it stays in the loop, not quit any more.
> what's the role does the daemon state plays?

Take a look at the documentation for the threading module here:, and the
discussion on daemon vs non-daemon threads here:

Basically, as long as at least one non-daemon thread is still running,
your program will not exit.

> <snip code>


More information about the Python-list mailing list