- extend the VM interrupts to distinguish between read and write
events
- add new ADD-PENDING-CHANNEL instruction to the VM
- add WAIT-FOR-CHANNELS procedure to the run-time system
- implement SELECT and SELECT! on top of that in newports.scm
This runs some basic tests, but in general should be considered
largely untested.
Moreover, SELECT/SELECT! never detect any exceptional conditions---the
returned vectors are always empty. This is because the VM doesn't
really track those, and it's unclear whether it would be worth the
effort.
Scheme 48 1.0.1.
Namely, instead of associating a list of queues with every thread, we
associate a single cell, holding the thread. That cell is stored in
thread queues, and once a thread is made runnable again, the cell is
set to #f. The thread-queue accessors ignore cells containing #f.
Implement an experimental OBTAIN-LOCK-MULTIPLE to test the whole
thing.
command levels (as there *are* no command levels for things like scsh
-c):
There's now a new asynchronous event, similar to SPAWN, called NARROW.
It spawns off a new scheduler with just one thread (which runs the
thunk provided as an argument to NARROW) and blocks the current one
until the narrowed scheduler finishes.
For this to work, two schedulers need to be in place: the root
scheduler which performs the housekeeping, and another one inside that
which is the one the program uses---otherwise it's the root scheduler
that's blocked, and that means no housekeeping gets done. This is
trivially the case for interactive mode, as the command-levels all
have their own schedulers, but we also need to make sure scsh's entry
point fires up its own initial scheduler.
These can be used (together with fluids) to implement something akin
to PLT's and Chez's parameters for holding thread-local state such as
CWD, syslog channel, etc.
drawbacks:
1.) Since # and | may be part of an identifier, a#|bla|# is
read as a#|bla|# not as a.
2.) The REPL won't read a comment for its own, it will wait for
another value:
>#|bla|#
3
3
>