anchor.diff:                  ;; ELSE: Message for unused channel
                   (warn-nonexistent-channel))))))))
   
  -(defun handle-command (async-conn)
  -  (let ((in-fd (async-connection/cmd-fd-reader async-conn))
  -        (size (cffi:foreign-type-size :int)))
  +(defun load-integer-from-fd (in-fd)
  +  (let ((size (cffi:foreign-type-size :int)))
       (cffi:with-foreign-pointer (buf size)
         (let ((result (iolib.syscalls:read in-fd buf size)))
           (unless (= result size)
             (error "Unable to read from pipe"))
  -        (let ((index (cffi:mem-ref buf :int)))
  -          (let ((cmd (bordeaux-threads:with-lock-held ((async-connection/lock async-conn))
  -                       (with-accessors ((requests async-connection/requests)) async-conn
  -                         (let ((cmd (assoc index requests)))
  -                           (unless cmd
  -                             (error "Attempt to get missing command index: ~s" index))
  -                           (setf requests (delete (car cmd) requests :key #'car))
  -                           (cdr cmd))))))
  -            (let ((result (funcall (first cmd))))
  -              (funcall (second cmd) result))))))))
  +        (cffi:mem-ref buf :int)))))
  +
  +(defun handle-command (async-conn)
  +  (with-accessors ((b-lock async-connection/b-lock)
  +                   (b-condvar async-connection/b-condvar)
  +                   (b-current async-connection/b-current))
  +      async-conn
  +    (let ((request-index (load-integer-from-fd (async-connection/cmd-fd-reader async-conn))))
  +      (bordeaux-threads:with-lock-held (b-lock)
  +        (when b-current
  +          (error "The current handler index is not NIL: ~s" b-current))
  +        (setf b-current request-index)
  +        (bordeaux-threads:condition-notify b-condvar)
  +        (loop
  +           while b-current
  +           do (bordeaux-threads:condition-wait b-condvar b-lock))))))
   
   (defun run-sync-loop (async-conn)
     (let* ((conn (async-connection/connection async-conn))
  
positive.code:                   :reader async-connection/connection)
     (channels      :type vector
                    :initform (make-array (list 10)
                                          :element-type '(or null async-channel)
                                          :initial-element nil
                                          :adjustable t
                                          :fill-pointer nil)
                    :reader async-connection/channels)
     (cmd-fd        :type fixnum
                    :accessor async-connection/cmd-fd)
  
negative.code: 
  (defun async-test ()
    (let* ((c (make-async-connection)))
      (defparameter *c* c)
      (unwind-protect
           (let ((ch (open-channel c :message-callback (lambda (msg)
                                                         (log:info "Msg: ~s" (babel:octets-to-string (cl-rabbit:message/body (cl-rabbit:envelope/message msg)))))))
  