anchor.diff:     (close-p       :type t
                     :initform nil
                     :accessor async-connection/close-p)
  -   (requests      :type list
  +   (b-current     :type (or null integer)
                     :initform nil
  -                  :accessor async-connection/requests)
  -   (request-index :type integer
  +                  :accessor async-connection/b-current)
  +   (b-index       :type integer
                     :initform 0
  -                  :accessor async-connection/request-index)
  -   (lock          :type t
  +                  :accessor async-connection/b-index)
  +   (b-lock        :type t
                     :initform (bordeaux-threads:make-lock "Sync connection lock")
  -                  :reader async-connection/lock)))
  +                  :reader async-connection/b-lock)
  +   (b-condvar     :type t
  +                  :initform (bordeaux-threads:make-condition-variable :name "Sync connection condvar")
  +                  :reader async-connection/b-condvar)))
   
   (defun process-unexpected-frame (conn)
     (simple-wait-frame conn))
  
positive.code: 
  (defun async-test ()
    (let* ((c (make-async-connection)))
      (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)))))))
  
negative.code:        do (wait-for-frame async-conn)
         else do (iolib:event-dispatch event-base :one-shot t))))
  
  (defun get-next-b-index (async-conn)
    (bordeaux-threads:with-lock-held ((async-connection/b-lock async-conn))
      (incf (async-connection/b-index async-conn))))
  
  (defun run-in-sync-thread (async-conn fn)
    (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 (get-next-b-index async-conn))
            (size (cffi:foreign-type-size :int)))
        (cffi:with-foreign-pointer (buf size)
          (setf (cffi:mem-ref buf :int) request-index)
          (iolib.syscalls:write (async-connection/cmd-fd async-conn) buf size))
        (bordeaux-threads:with-lock-held (b-lock)
          (loop
             until (eql b-current request-index)
             do (bordeaux-threads:condition-wait b-condvar b-lock)))
        (unwind-protect
             (funcall fn)
          (bordeaux-threads:with-lock-held (b-lock)
            (setf b-current nil)
            (bordeaux-threads:condition-notify b-condvar))))))
  
  (defmacro with-sync (conn &body body)
    `(run-in-sync-thread ,conn (lambda () ,@body)))
  