Gets a value from a hash-table
, adding a new value if this fails, all with the table locked.
The function ensure-hash-entry
gets the value for the key key in the hash table hash-table, and if this fails puts a new value new-value in hash-table and returns it. ensure-hash-entry
does all this with hash-table locked.
If the key key is not found, then if in-lock-constructor is non-nil then in-lock-constructor is called with new-value as its argument, and the result is put in the table and returned. If key is not found and in-lock-constructor is nil
, new-value is put in the table and returned.
ensure-hash-entry
is quite inefficient because it always locks the hash table. Normally you should use with-ensuring-gethash or gethash-ensuring instead.
LispWorks User Guide and Reference Manual - 20 Sep 2017