Front page | perl.perl5.porters |
Postings from August 2002
Re: Ideas for 5.10
Thread Previous
|
Thread Next
From:
Nicholas Clark
Date:
August 12, 2002 03:20
Subject:
Re: Ideas for 5.10
Message ID:
20020812111853.D97456@plum.flirble.org
On Mon, Aug 12, 2002 at 11:02:52AM +0100, Nick Ing-Simmons wrote:
> Nicholas Clark <nick@unfortu.net> writes:
> >
> >It's not clear to me how the PerlIO vtable allows a layer to distinguish to
> >the layer below whether it is merely asking for it to empty its buffer
> >(in a the middle of a regular write) or hurry the data along as fast as
> >possible. (I suspect "expedite" is the marketdroid term)
>
> There is no mechanism - drat (you mentioned this before and I forgot).
But we have an API version in the release 5.8.0, don't we? So it would
be possible to update the flush vtable entry to take a flags argument,
and compensate for any existing binary-compiled PerlIO layers that
declare themselves to be using the current API?
> >For example, PerlIOBuf_write does this for the non-linebuf case:
> >
> > if (b->ptr >= (b->buf + b->bufsiz))
> > PerlIO_flush(f);
> > }
> >
> >
> >It's calling flush on itself to empty the buffer. Yes, it's true that it is
> >"flushing" in one sense. But it's not really flushing in the fflush() sense.
> >(ie please sync this data to disk; don't return until you've done it/
> > please send this socket data at once; set the push flag, don't buffer it up
> > so that you can send the full window at once/
> > please pass this data out the other side of the compressor immediately, even
> > if that gives sub-optimal compression; don't hang onto it for the best bulk
> > transfer)
>
> It is far from clear that fflush() has all those connotations or effects ;-)
Well, it's certainly not going to know how to play ball with a compression
library such as zlib. There's a niggly bit of my brain saying that I read
somewhere that there's no part of the sockets API that allows one to set the
PSH flag, and a man page for fflush says "Note that fflush only flushes
the user space buffers provided by the C library. To ensure that the data
is physically stored on disk the kernel buffers must be flushed too, eg
with sync(2) or fsync(2)"
So I think that fflush doesn't do any of them. But we're perl - we can do
better than C. :-)
Nicholas Clark
Thread Previous
|
Thread Next