Way to unblock sys.stdin.readline() call
joamag at gmail.com
Sun Jun 22 22:23:14 CEST 2008
On Jun 21, 11:34 pm, Terry Reedy <tjre... at udel.edu> wrote:
> 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
> <process l>
> except queue.Empty
> <whatever without l>
Yes, that would work but still I would have a thread that would block
(the one with the readline call).
The problem with that solution is that if I try to exit the
application, while the thread is waiting in the readline call, that
thread would be blocking the exit of the application.
That behavior occurs even if the thread is configured in daemon mode.
Do you think it’s possible to solve the readline blocking problem in
any other way ?
More information about the Python-list