anchor.diff:  
   (defun fd-managed-p (fd)
     "Returns t iff the given fd is being managed with retain/release."
  -  (with-recursive-lock-held (%fd-retain-count-table-lock%)
  +  (with-safe-fd-manipulation
       (%fd-managed-p fd)))
   
   (define-condition fd-already-managed (error)
  
positive.code: 
  (optimization-settings)
  
  (define-once-global %fd-retain-count-table% (make-hash-table)
    (:documentation
     "This table tracks how many outstanding retains each file
  descriptor has."))
  (define-once-global %fd-retain-count-table-lock% (make-recursive-lock)
    (:documentation
     "This lock protects `%fd-retain-count-table-lock%'."))
  
  (defparameter *autorelease-fd-scope* nil
    "The collection of file descriptors that should be released when the
  
negative.code:     :accessor fd-already-managed-fd))
    (:report (lambda (c s) (format s "Can't enter FD ~A into retain/release management again" (fd-already-managed-fd c)))))
  
  (defun manage-new-fd (fd)
    "Enter the given fd into the retain/release table.
  
  To safely use this function, you must
  1. Inside the body of a `with-safe-fd-manipulation' form, create and track a new fd
  2. Call this function
  
  Any other sequence of events has the potential to introduce a race.
  In particular, once an unmanaged fd is added to *fd-bindings*, it must
  not become a managed fd."
    (with-safe-fd-manipulation
      (when (gethash fd %fd-retain-count-table%)
        (error 'fd-already-managed :fd fd))
      (setf (gethash fd %fd-retain-count-table%) 1)
      fd))
  
  (define-condition fd-not-managed (error)
    ((fd
  