Re: how to close a stalled file descriptor?
- From: Ben Morrow <ben@xxxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 23:03:26 +0000
Quoth Glenn <eponymousalias@xxxxxxxxx>:
I'm having trouble closing a file descriptor on a stalled named pipe.
To unblock myself if the write takes too long because the pipe is full
and there is no reader on the other end of the pipe, I put in place
a signal handler.
Which OS are you using? Under most Unices, a writing to a full pipe with
no readers will first send SIGPIPE, and if that is handled or ignored,
fail with EPIPE.
But if the signal handler is invoked and I regain
control, on any subsequent attempt to close the file descriptor,
it stalls again!
When you say 'file descriptor' do you mean 'Perl file handle'? Which
perl version are you using? Are you using PerlIO? It's possible that you
are closing a Perl FH, which is attempting to flush its buffers and
handling the error badly. If this is the case, then you may be able to
ignore (and lose) the buffer by pushing a :unix layer before you close.
Ben
.
- Follow-Ups:
- Re: how to close a stalled file descriptor?
- From: Glenn
- Re: how to close a stalled file descriptor?
- References:
- how to close a stalled file descriptor?
- From: Glenn
- how to close a stalled file descriptor?
- Prev by Date: Re: problems building perl modules, path question
- Next by Date: Re: reading a directory, first files the newest ones
- Previous by thread: how to close a stalled file descriptor?
- Next by thread: Re: how to close a stalled file descriptor?
- Index(es):
Relevant Pages
|