Threads

David Reed dreedmac at columbus.rr.com
Thu May 11 20:16:21 EDT 2006


On May 11, 2006, at 8:02 PM, placid wrote:

>
> Carl J. Van Arsdall wrote:
>> placid wrote:
>>> Hi all,
>>>
>>> In Python, Threads cannot be paused, i remember reading this  
>>> somewhere,
>>> so is there a way around this ?
>>>
>>
>> When you say paused do you mean paused by an external source or  
>> paused
>> by a call internal to the thread?  There are plenty of  
>> synchronization
>> constructs for making threads wait: Check out Events and Conditions
>
> 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 ?
>
>


The previous poster answered your question - you want to use a  
condition variable.

http://docs.python.org/lib/condition-objects.html

Dave




More information about the Python-list mailing list