Is there any way this queue read can possibly block?
nagle at animats.com
Sat May 2 20:10:32 CEST 2009
That wasn't the problem. An incoherent bug report from a user
was the problem.
Carl Banks wrote:
> On Apr 30, 11:48 am, John Nagle <na... at animats.com> wrote:
>> def draininput(self) : # consume any queued input
>> while True :
>> ch = self.inqueue.get_nowait() # get input, if any
>> except Queue.Empty: # if empty
>> return # done
>> "self.inqueue" is a Queue object. The intent here is to drain the
>> queue, then return. Is there any way this can possibly block or hang?
> Yes, but it'll be waiting to acquire the semaphore which Queues
> normally don't hold onto for long.
> Carl Banks
>> I wouldn't think so. Another thread is doing "put" operations,
>> but slowly, never more than 5 per second.
>> (It's working for me, but a user of a program of mine is having a problem.)
>> John Nagle
More information about the Python-list