[comp.sys.amiga] Looking for "Block-less" Read

TLIMONCE@DREW.BITNET (02/23/88)

[line eater food:  munch, munch, munch]
I am writing a server for a BBS program.  Now things get
complicated here and there but keeping it a simple finate
state machine (thank you Eric L. & Perry K. for that
tip) makes everything straight forward.

Here's the problem:  This server will handle all IO to the
serial.device, console.device, and intuition (menus reports, etc).
(Bear with me, I don't know the correct CS terms for this
yet)  Because of this, for any given state, any input will
be handled quickly so that other inputs (possibly for other
ports, etc) can be handled.  (i.e., the other ports will not
be hindered... too much)

Does that make sence so far?

I have done this so far 100% in theory and practice but now I am
adding something so that the server can be given a file name and
it will print it 60-90 chars at a time to the serial/console.device.

Pseudo-code looks like this:
command rec'd is TS_PRINTFILE:
         Open File
         if error
                reply to TS_PRINTFILE with error=no_file.
         get 70 chars
         if actual chars read is 0 then
                reply to TS_PRINTFILE with error=empty_file.
         send text to window
         filter for modem
         send text to modem
         mode = printfile_1
         go to Wait()
[much deleted]
serial is done writing:
   if mode = printfile_1
         get 70 chars
         if actual chars read is 0 then
                reply to TS_PRINTFILE with error=none.
                mode=server_is_waiting_for_next_command
                go to Wait()
         send text to window
         filter for modem
         send text to modem
         go to Wait()
[other modes deleted]

So, this all works fine except one thing.  When "get 70 chars" is done
the entire server (which is actually terminal.device) gets tied up and
all the ports must wait.

/*
You say, "Boy, what a long story.  Why didn't he just ask for a way to do
file reads in a asynchronous way?"

Golly, I don't know Beav.
*/

Now I don't want to mess with the trackdisk.device.  I'm afraid to go to
those lower-level routines which might bring incompatibilities with
future OS/FS changes.

If I get the source to the bindings to AmigaDOS's Read() will I find a
Wait() of some sort that would then let me just do a "block-less Read()"?
(Am I answering my own question?)  I'll only do that as a last resort.

Of course, since most customers are not multi-user I can live with this
bottleneck for now but when when someone starts producing extra serial
ports for Amigas... (Hint, hint, hint).

Tom Limoncelli | Drew U/Box 1060/Madison NJ 07940 | tlimonce@drew.BITNET
    Disclaimer: These are my views, not my employer or Drew Univesity
--------------------------------------------------------------------------