Changeset 7865


Ignore:
Timestamp:
Dec 10, 2007, 12:53:43 PM (13 years ago)
Author:
gb
Message:

GETHASH locks hash-table for reading, promotes to write-access only if
rehashing needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-0/l0-hash.lisp

    r7722 r7865  
    701701    (with-lock-context
    702702      (without-interrupts
    703        (setq readonly (eq #+notyet (read-lock-hash-table hash)
    704                           #-notyet (if (nhash.read-only hash)
    705                                      :readonly
    706                                      (write-lock-hash-table hash))
    707                           :readonly))
     703       (setq readonly (eq (read-lock-hash-table hash) :readonly))
    708704       (let* ((vector (nhash.vector hash)))
    709705         (if (and (eq key (nhash.vector.cache-key vector))
     
    729725                      (return))
    730726                     ((%needs-rehashing-p hash)
     727                      (%lock-gc-lock)
    731728                      (setq gc-locked t)
    732                       (%lock-gc-lock)
    733                       (%rehash hash))
     729                      (unless readonly
     730                        (let* ((lock (nhash.exclusion-lock hash)))
     731                          (when lock (%promote-rwlock lock))))
     732                      (when (%needs-rehashing-p hash)
     733                        (%rehash hash)))
    734734                     (t (return)))))))
    735735       (when gc-locked (%unlock-gc-lock))
Note: See TracChangeset for help on using the changeset viewer.