in reply to Re^2: select() and input buffering
in thread select() and input buffering
Even if select could see the contents of the buffers (which it sometimes does, I believe), you still couldn't use readline (<$fh>).
I listed two conditions that make sysread suitable. Its non-buffering aspect was just one of them. The other is that it returns as soon as there's data available, so it doesn't block. readline, on the other hand, blocks.
What makes sysread complicated, the use of buffers, is the result of it's non-blocking nature. Its non-blocking nature is the reason you want to use it. If readline was non-blocking, you'd have to jump through the same hoops.
select is inherently complicated. Imagine if you had both readers and writers! Again, if you want simplicity, you want threads.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: select() and input buffering
by declan (Initiate) on Apr 15, 2011 at 04:53 UTC | |
by ikegami (Patriarch) on Apr 15, 2011 at 20:22 UTC |