Simple thread-safe counter?

Artie Gold artiegold at austin.rr.com
Sat Apr 2 10:39:48 EST 2005


Leif K-Brooks wrote:
> Artie Gold wrote:
> 
>> Skip Montanaro wrote:
>>
>>>     counter = Queue.Queue()
>>>     def f():
>>>         i = counter.get()
>>
>>
>> I think you need:
>>           i = counter.get(True)
> 
> 
> The default value for the "block" argument to Queue.get is True.

Right. I misparsed the entry in the documentation:

"If optional args block is true and timeout is None (the default), block 
if necessary..."

Thanks,
--ag

-- 
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays



More information about the Python-list mailing list