anchor.diff:    (setq *io-descriptions*
           (delete desc *io-descriptions*)))
   
  +
  +
  +;;;; Making connections
  +
   (defvar *host-translations* '())
   
   (defun io-descriptor-connect (desc host port)
     (setq host
           (or (cdr (assoc host *host-translations* :test #'string=))
  -            host))                 
  +            host))
     (setf (io-descriptor-stream desc)
           (open-active-socket host port))
     (mess 3 "connect to ~A:~A = ~A" host port (io-descriptor-stream desc))
  -  (setf (io-descriptor-status desc) :connected))            
  +  (setf (io-descriptor-status desc) :connected))
   
   (defun io-descriptor-working-p (desc)
     (and (not (eql (io-descriptor-status desc) :broken))
          (not (socket-stream-closed-p (io-descriptor-stream desc)))))
   
  +
  +
  +;;;; Reading 
  +
  +
  +(defun io-descriptor-read-ready (desc)
  +  (and (io-descriptor-read-buffer desc)
  +       (< (io-descriptor-read-pos desc)
  +          (io-descriptor-read-limit desc))))
  +
  +
  +#+digitool
   (defun io-desc-read (desc)
     (handler-case
  -    (let ((stream (io-descriptor-stream desc)))
  -      (read-octets (io-descriptor-read-buffer desc)
  -                   (io-descriptor-read-pos desc) (io-descriptor-read-limit desc)
  -                   stream)
  -      (setf (io-descriptor-read-pos desc) (io-descriptor-read-limit desc))
  -      (io-queue-event :read-ready desc))
  +    (loop
  +      (mess 1 "io-desc-read loop")
  +      (let ((stream (io-descriptor-stream desc)))
  +        (unless (socket-stream-listen stream)
  +          (process-wait-with-timeout "wait for input" nil
  +                                     #'socket-stream-listen stream))
  +        (read-octets (io-descriptor-read-buffer desc)
  +                     (io-descriptor-read-pos desc) (io-descriptor-read-limit desc)
  +                     stream)
  +        (setf (io-descriptor-read-pos desc) (io-descriptor-read-limit desc))
  +        (mess 1 "Enqueue event read-ready")
  +        (io-queue-event :read-ready desc))
  +      (mess 1 "Disable process ~A" (current-process))
  +      (ccl:process-disable (current-process))
  +      (ccl:process-allow-schedule))
       (stream-error
        (e)
        (setf (io-descriptor-status desc) :broken)
        (setf (io-descriptor-error desc)  e)
  -     (io-queue-event :error desc) ))
  -  (setf (io-descriptor-read-process desc) nil))
  - 
  +     (io-queue-event :error desc))))
  +
  +#+digitool
  +(defmethod io-ready-for-read ((system io-system-multiprocess) desc)
  +  (let ((old-process (io-descriptor-read-process desc)))
  +    (cond (old-process
  +           (mess 1 "Old process= ~A" old-process)
  +           ;;(ccl:process-reset-and-enable old-process)
  +           (ccl:process-enable old-process)
  +           (mess 1 "reset: ~A" old-process))
  +          (t
  +           (let ((new (start-process "CORBA read" #'io-desc-read desc)))
  +             (mess 1 "New process= ~A" new)
  +             (setf (io-descriptor-read-process desc) new))))))
  +
  +
   (defun io-descriptor-set-read (desc buf start end)
     (setf (io-descriptor-read-buffer desc) buf
           (io-descriptor-read-pos desc) start
           (io-descriptor-read-limit desc) end)
  -  (when (and *io-multi-process* buf (> end start))
  -    (push desc *io-ready-for-read*))
  +  (when (and buf (> end start))
  +    (io-ready-for-read *io-system* desc))
     nil)
  +
  +
  +
  +;;;; Writing 
  +
  +
  +(defun io-descriptor-write-ready (desc)
  +  (and (io-descriptor-write-buffer desc)
  +       (< (io-descriptor-write-pos desc)
  +          (io-descriptor-write-limit desc))))
   
   
   (defun io-desc-write (desc)
  
positive.code: ;; - define what error contain (e.g. a condition)
  ;; ~ status member nil :connected :broken
  
  (defparameter *io-multi-process* (or #+mcl t ))
  (defparameter *io-background-write-treshold* 200)
  
  (defvar *io-event-queue* nil)
  (defvar *io-ready-for-read* nil)
  
  (defvar *io-socket* nil
    "listener socket (or similar). Producer of connections.")
  (defvar *io-listener-process* nil)
  
  (defvar *io-descriptions* nil
    "List of all io-descriptors that we will do I/O on.")
  
  
  (defun io-fix-broken ()
    (setq *io-descriptions*
          (loop for desc in *io-descriptions*
                if (eq :broken (io-descriptor-status desc))
                do (close (io-descriptor-stream desc))
                else collect desc))
    (setq *io-ready-for-read*
          (loop for desc in *io-ready-for-read*
                unless (eq :broken (io-descriptor-status desc))
                collect desc)))
  
  (defun io-reset (&key (listener nil))
    (when (and listener *io-socket*)
  
negative.code: ;;;; clorb-io.lisp  --  a reactive IO layer for CLORB
  ;;
  ;; io-reset ()
  ;; io-create-listener (&optional port)
  