X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fhash-table.lisp;h=c7afa7ecf2deef1c3a10d2967311e1961a55a64b;hb=82cd148d729c241e79c8df04b700beec1b7c55de;hp=d72595cc71e0cf9b62f6a2a9203865116bd29166;hpb=52191144ec19554abe6e4ebae2dd6234b1a345dd;p=sbcl.git diff --git a/src/code/hash-table.lisp b/src/code/hash-table.lisp index d72595c..c7afa7e 100644 --- a/src/code/hash-table.lisp +++ b/src/code/hash-table.lisp @@ -67,8 +67,8 @@ ;; respective key. (hash-vector nil :type (or null (simple-array sb!vm:word (*)))) ;; Used for locking GETHASH/(SETF GETHASH)/REMHASH - (spinlock (sb!thread::make-spinlock :name "hash-table lock") - :type sb!thread::spinlock :read-only t) + (lock (sb!thread:make-mutex :name "hash-table lock") + :type sb!thread:mutex :read-only t) ;; The GC will set this to T if it moves an EQ-based key. This used ;; to be signaled by a bit in the header of the kv vector, but that ;; implementation caused some concurrency issues when we stopped @@ -104,7 +104,7 @@ values are the key and the value of the next object. Consequences are undefined if HASH-TABLE is mutated during execution of BODY, except for changing or removing elements corresponding to the current key. The -applies to all threads, not just the curren one -- even for synchronized +applies to all threads, not just the current one -- even for synchronized hash-tables. If the table may be mutated by another thread during iteration, use eg. SB-EXT:WITH-LOCKED-HASH-TABLE to protect the WITH-HASH-TABLE-ITERATOR for." @@ -144,6 +144,10 @@ 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-system-spinlock - ((hash-table-spinlock ,hash-table)) + `(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))