Why doesn't _IO_do_write in fileops.c check for EINTR?

George T. Talbot george@moberg.com
Thu Apr 20 13:08:00 GMT 2000


Ulrich Drepper wrote:
> 
> "George T. Talbot" <george@moberg.com> writes:
> 
> > Might a better sequence in (for example) _IO_do_write() look like this:
> >
> >   do {
> >     count = _IO_SYSWRITE (fp, data, to_do);
> >   } while ((count == (_IO_size_t) -1) && (errno == EINTR));
> 
> No.  The write functions must be able to time out.  Setting alarm()
> and try writing, returning after a while because the device does not
> respond.  Leave libio as it is.

I just tried testing with my program which does something like this:


	ostream*	x = new ostream(new filebuf(socket_number, "socket", ios::out));

	*x << "blah blah blah blah" << flush;

	closesocket(socket_number);
	delete x;


It works perfectly.  Even under high load (so far).  You were right that libio
is already doing the right thing with respect to EINTR.  Sorry if my last
couple of messages were confusing.  Thanks for the help.

--
George T. Talbot
<george at moberg dot com>


More information about the Libstdc++ mailing list