newbie question on threading
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Sat Oct 12 13:50:09 EDT 2002
Hi,
I have another, very naive, question on the threading model. It is about
the condition object and the wait method. I have read the code, and the
main loop is commented thus (in part):
#Balancing act: We can't afford a pure busy loop, so we
#have to sleep; but if we sleep the whole timeout time,
#we'll be unresponsive.
My question is: why is a busy loop not affordable (without a sleep
call), e.g. something like (in pseudo-code description)
while 1:
<acquire lock>
if <acquire sucessfull>:
break
if <timedout?>:
break
<calculate endtime>
Thanks in advance,
Gonçalo Rodrigues
More information about the Python-list
mailing list