Condition.wait(0.5) doesn't respect it's timeout

Aahz aahz at pythoncraft.com
Sat Apr 18 12:03:05 EDT 2009


In article <19475d1c-ee83-4466-ba55-b352ea760e41 at x5g2000yqk.googlegroups.com>,
 <stephane.bisinger at gmail.com> wrote:
>On Apr 18, 4:28=A0pm, a... at pythoncraft.com (Aahz) wrote:
>>
>> Essentially, you use the Queue instead of the Condition. =A0When you want
>> to explicitly give up control in a thread, you get() on the Queue until
>> you get an object (with the optional timeout). =A0When the other thread i=
>s
>> done processing, it puts an object on the Queue (optionally doing a
>> get_nowait() at some point if it wants to make sure the Queue is cleaned
>> up).
>
>Yep but as I said I have nothing to pass around

You create it -- it's essentially a plain sentinel in this case.

>> The critical advantage of using Queue is that you don't have to do the
>> acquire()/release() dance.
>
>And neither do I have to using the "with" statement ;)

Fair enough -- I was stuck on Python 2.3 in my last job and I still
haven't caught up.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list