Asynchronous IO RFC

Andrew Whitworth wknight8111 at gmail.com
Mon May 25 14:59:17 UTC 2009


On Mon, May 25, 2009 at 10:40 AM, NotFound <julian.notfound at gmail.com> wrote:
>> 1) I don't want to have an asynchronous version of the "open" opcode.
>>
>> 2) We're going to need to open streams in either synchronous or
>> asynchronous mode. I'm proposing we use an "n" mode flag for
>> non-blocking and a "b" flag for blocking. This way we can use existing
>> methods "read" and "write", etc to do what we want.
>
> Note that non blocking and asynchronous may (and I think should) be
> orthogonal. A non blocking synchronous read just returns an empty
> result if there is no available data.

Ah, true. I am glossing over the differences between the two terms.
Plus, I can't reuse "a" for asynchronous, because we already use that
for "append". A better flag is probably needed, suggestions welcome.
Maybe "A" (as opposed to "a") and "S" for asynchronous and synchronous
respectively?

That said, there are four types of IO that we should be aware of:
Blocking-synchronous, Nonblocking-synchronous, blocking-asynchronous
and nonblocking-asynchronous. What I'm suggesting here with my changes
is that we essentially have two types of streams (synchronous and
asynchronous) and two types of operations on those streams (blocking
and non-blocking). This gives us the flexibility to use all four types
as necessary.

Notice also that the PDD doesn't really talk about this detail, so
it's something we need to add in either case.

--Andrew Whitworth


More information about the parrot-dev mailing list