This runtime requires microcode version 11.131 or later. Edwin
authorChris Hanson <org/chris-hanson/cph>
Tue, 27 Apr 1993 09:14:12 +0000 (09:14 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 27 Apr 1993 09:14:12 +0000 (09:14 +0000)
commit35e21594f14d78aa2804c0897617dbf48a49ebfe
tree4dfa5441ef6e47809ac6821047f25f533e1383a4
parentdf9c4d414eccc904378061fc81d2c286206fd4f1
This runtime requires microcode version 11.131 or later.  Edwin
versions prior to 3.78 will not work correctly with this runtime.

The aim of these changes is to provide a central mechanism to detect
input on all input channels, and thus to prevent a single thread from
performing a blocking input operation that locks out other threads
that can do useful work.  Now, in places where a thread would block on
an input device, it instead registers its interest in the device
with a centralized registry, and suspends.  If all threads in the
system are suspended, then Scheme blocks by calling `select' and
waiting for something interesting to happen.

* Introduce new procedures that use the `select' system call to
  provide a mechanism to monitor input availability on many input
  devices simultaneously:

ADD-TO-SELECT-REGISTRY!
CHANNEL-DESCRIPTOR-FOR-SELECT
DEREGISTER-INPUT-THREAD-EVENT
MAKE-SELECT-REGISTRY
PERMANENTLY-REGISTER-INPUT-THREAD-EVENT
REGISTER-INPUT-THREAD-EVENT
REMOVE-FROM-SELECT-REGISTRY!
SELECT-DESCRIPTOR
SELECT-REGISTRY-TEST
TEST-FOR-INPUT-ON-CHANNEL
TEST-FOR-INPUT-ON-DESCRIPTOR

  These procedures require the operating system to support `select' or
  some equivalent.  Calling them in another operating system, e.g.
  DOS, will cause an error to be signalled.

* Delete old `select' mechanism procedures which are no longer used or
  supported (these will be deleted from the microcode in the future):

CHANNEL-REGISTER
CHANNEL-UNREGISTER
CHANNEL-REGISTERED?
CHANNEL-SELECT-THEN-READ

* Modify CHANNEL-READ to automatically call TEST-FOR-INPUT-ON-CHANNEL
  if the `select' system call is supported by the operating system.
  One consequence of this is that CHANNEL-READ can return #F for
  channels that are in "blocking" mode; if you don't want #F you must
  call CHANNEL-READ-BLOCK instead (this was always a good idea
  anyway).

* Change X graphics devices to use the new select machinery to preview
  the event stream from the X server.

--------------------
The following changes are not part of the general aim stated above,
although most of them either derive from it or support it:

* Add new procedures to the "threads" package: (THREADS-LIST) returns
  a list of all thread objects, including dead threads, that haven't
  yet been garbage collected.  (THREAD-EXECUTION-STATE thread) returns
  the "execution state" of a thread, a symbol.

* Add code to the threads package that attempts to clean up all
  attachments of the thread when it is exited.  This is a
  generalization of previous patches generated by GJR and GJS for
  6.001.

* Plug several holes in the thread event delivery mechanism which
  allowed the threads package to get into states where events were not
  delivered to their threads.

* SUSPEND-CURRENT-THREAD now returns the event that caused the thread
  the be resumed; previously it had an unspecified value.  If several
  events are delivered before resumption, the event returned is the
  first one that is not #F, or #F if all of the events were #F.

* Fix several typos that caused errors when generating reports for
  conditions in the threads package.
v7/src/runtime/io.scm
v7/src/runtime/runtime.pkg
v7/src/runtime/thread.scm
v7/src/runtime/unxprm.scm
v7/src/runtime/x11graph.scm
v8/src/runtime/runtime.pkg