anchor.diff:  (defun io-queue-event (type desc)
     (push (list type desc) *io-event-queue*))
   
  +(defun io-work-pending-p ()
  +  (or *io-work-pending* *io-event-queue*))
   
    
  
positive.code: ;;;; Shortcut stream
  
  
  (defclass octets-stream ()
    ((buffer  :initform nil  :accessor octets-stream-buffer)))
  
  (defclass shortcut-stream ()
    ((output  :initarg :output  :accessor shortcut-stream-output)
     (input   :initarg :input   :accessor shortcut-stream-input )))
  
  
  (defun io-ostream-write (octets-stream seq start end)
    (with-accessors ((buffer octets-stream-buffer)) octets-stream
      (setf buffer (concatenate 'octets buffer (subseq seq start end)))))
  
  (defun io-ostream-read (octets-stream seq start end)
    (let ((len (- end start)))
      (with-accessors ((buffer octets-stream-buffer)) octets-stream
        (unless (> len (length buffer))
          (replace seq buffer :start1 start :end1 end :start2 0 :end2 len)
          (setf buffer (subseq buffer len))
          t))))
  
  
  (defun io-shortcut-write (shortcut-stream seq start end)
    (io-ostream-write (shortcut-stream-output shortcut-stream) seq start end))
  
  (defun io-shortcut-read (shortcut-stream seq start end)
    (io-ostream-read (shortcut-stream-input shortcut-stream) seq start end))
  
  
  (defun io-descriptor-shortcut-connect (desc)
    (let ((i-stream (make-instance 'octets-stream))
          (o-stream (make-instance 'octets-stream)))
      (let ((other (make-io-descriptor
                    :stream (make-instance 'shortcut-stream :input o-stream :output i-stream)
                    :status :connected
                    :shortcut-p desc)))
        (push other *io-descriptions*)
        (io-queue-event :new other)
        (setf (io-descriptor-stream desc) (make-instance 'shortcut-stream :input i-stream :output o-stream))
        (setf (io-descriptor-shortcut-p desc) other))))
  
  
  
negative.code:   (values port (passive-socket-host *io-socket*)))
  
  
  (defun io-create-descriptor (&optional conn)
    (let ((desc (make-io-descriptor :connection conn)))
      (push desc *io-descriptions*)
      desc))
  
  (defun io-descriptor-associate-connection (desc conn)
    (setf (io-descriptor-connection desc) conn))
  
  (defun io-descriptor-destroy (desc)
    (setf (io-descriptor-status desc) :broken)
    (ignore-errors
      (close (io-descriptor-stream desc)))
    (setf (io-descriptor-connection desc) nil)
    (setq *io-descriptions* (delete desc *io-descriptions*)))
  
  
  