in reply to Re^4: Pipes and IO::Select's method can_write()
in thread Pipes and IO::Select's method can_write()
I was mainly just wondering why the can_write() method does essentially say "Yes, I can write", if it can't...
The underlying function is called select. can_write is a misnomer. It doesn't alert of the ability to write. It alerts the receipt of a write event. The inability to write is a write event.
you get exactly the same behaviour, if the child is still alive, but doesn't take input (as when explicitly having closed STDIN)
In both cases, the child explicitly closed STDIN. In both cases, the child is not (completely) dead. It only disappears after waitpid allows it to die.
why it can't figure out that there is some problem on the other end (or, at least, doesn't tell you)
But that's exactly what it does! select tells you there's an event, and syswrite tells you what the event is. It's convenient how you are saved from making a third system call.
Something else that might be of interest is knowing when a child becomes a zombie. I don't know if unix allows you to be alerted of such an event, but it can be determined by polling waitpid($pid, WNOHANG).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Pipes and IO::Select's method can_write()
by sgt (Deacon) on Feb 02, 2007 at 23:14 UTC | |
|
Re^6: Pipes and IO::Select's method can_write() (blocking)
by tye (Sage) on Feb 02, 2007 at 23:49 UTC | |
by sgt (Deacon) on Feb 03, 2007 at 22:13 UTC | |
by ikegami (Patriarch) on Feb 04, 2007 at 21:02 UTC |