no return value for threading.Condition.wait(timeout)?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Fri Jul 17 11:19:36 EDT 2009


Piet van Oostrum wrote:
>>>>>> Gabriel Rossetti <gabriel.rossetti at arimaz.com> (GR) wrote:
>>>>>>             
>
>   
>> GR> I have a 1-1 relation, I have a thread reading msgs from a network socket
>> GR> and a method waiting for an answer to arrive (see my thread
>> GR> "Threading.Condition problem"). I would like to be able to have a timeout
>> GR> as to not block forever, so the idea is to check if I returned because of a
>> GR> timeout or not.
>>     
>
> So that case is easy I think. After the wait just check if the answer
> has arrived.
>   
The problem is other answers could arrive that are not the one I want. 
Maybe I could check if I got the answer, if not then check how much time 
has elapsed, and if it's grater or equal to the timeout consider it a 
timeout. I still think a return value would be better though.




More information about the Python-list mailing list