If I understand your description correctly, you want
multi-threading. This is definitely sane and worthwhile. You can get
SSAX to use asynchronous i/o without any change to SSAX code. You need
a custom port (a.k.a. a soft port). A soft port looks
like a regular port. Therefore, it can be passed to read-char,
peek-char, and read functions -- and to SSAX. When you create such a
port, you specify you own functions to read characters, to flush and to
close the port. In your case, the read function will check if the OS
file handle or the socket has something to read. If not, the read
function does (yield), which continues to another thread, if
exists. Many Scheme systems provide soft ports, for example, SCM, MIT
Scheme, and Gambit 3.0. The latter doesn't document them though (but
you may want to check gambit/lib/_io.scm in the Gambit 3.0 distribution).
shows a simple threading system (with Gambit-specific parts) that
appears adequate for the job. Its preemptive multi-tasking is actually
Quite a few Scheme systems provide asynchronous i/o and
native threading facilities, for example, Chicken and Scheme48. In the
next version of Gambit, all i/o will be asynchronous by default. As Marc
the threading system of Gambit 4.0 is 1000 faster than that of
Linux threads. Alas, Marc didn't say when Gambit 4.0 would be released
From: Joerg F. Wittenberger <Joerg.W<ittenberger@po...> - 2002-04-24 22:27:01
> Quite a few Scheme systems provide asynchronous i/o and
> native threading facilities, for example, Chicken and Scheme48. In the
quite a few. I just had a conversation regarding saync i/o these days
with Felix (author of chicken). No, I/o blocks there.
But add rscheme to the list of schemes providing native, (time
sliced, none-cooperativ, hell what was the correct english term...)
threading and asynchronous i/o.
The worst of harm may often result from the best of intentions.