+ #',name))))
+ (macrolet ((,name () '(funcall ,function)))
+ ,@body))))
+
+(defmacro-mundanely with-locked-hash-table ((hash-table) &body body)
+ #!+sb-doc
+ "Limits concurrent accesses to HASH-TABLE for the duration of BODY.
+If HASH-TABLE is synchronized, BODY will execute with exclusive
+ownership of the table. If HASH-TABLE is not synchronized, BODY will
+execute with other WITH-LOCKED-HASH-TABLE bodies excluded -- exclusion
+of hash-table accesses not surrounded by WITH-LOCKED-HASH-TABLE is
+unspecified."
+ ;; Needless to say, this also excludes some internal bits, but
+ ;; getting there is too much detail when "unspecified" says what
+ ;; is important -- unpredictable, but harmless.
+ `(sb!thread::with-recursive-lock ((hash-table-lock ,hash-table))
+ ,@body))
+
+(defmacro-mundanely with-locked-system-table ((hash-table) &body body)
+ `(sb!thread::with-recursive-system-lock
+ ((hash-table-lock ,hash-table))
+ ,@body))