Way to unblock sys.stdin.readline() call

Terry Reedy tjreedy at udel.edu
Sat Jun 21 18:34:34 EDT 2008



joamag wrote:

> Is there any possible way to unblock the sys.stdin.readline() call
> from a different thread.

If you want the thread to do something 'else' when no input is 
available, would this work?  Put readline in a thread that puts lines in 
a q=queue.Quese().  Then
try:
     l=q.ge_nowait
     <process l>
except queue.Empty
     <whatever without l>




More information about the Python-list mailing list