Changeset 10483


Ignore:
Timestamp:
Aug 15, 2008, 10:26:29 PM (11 years ago)
Author:
gb
Message:

REGISTER-PACKAGE-REF: use a lock if gethash fails. Ensure that the
package-ref.pkg slot is set if the package exists (see ticket:326).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/nfasload.lisp

    r10416 r10483  
    247247(defvar *package-refs*)
    248248(setq *package-refs* (make-hash-table :test #'equal))
     249(defvar *package-refs-lock*)
     250(setq *package-refs-lock* (make-lock))
    249251
    250252(defun register-package-ref (name)
    251   (or (gethash name *package-refs*)
    252       (setf (gethash name *package-refs*) (make-package-ref name))))
     253  (let* ((ref
     254          (or (gethash name *package-refs*)
     255              (with-lock-grabbed (*package-refs-lock*)
     256                (or
     257                 (gethash name *package-refs*) ; check again
     258                 (let* ((r (make-package-ref name)))
     259                   (setf (gethash name *package-refs*) r)))))))
     260    (unless (package-ref.pkg ref)
     261      (setf (package-ref.pkg ref) (find-package name)))
     262    ref))
     263
    253264
    254265(dolist (p %all-packages%)
Note: See TracChangeset for help on using the changeset viewer.