sbcl.sbcl/tests/weak-ht-pounding.pure.lisp
2026-02-26 19:20:15 +00:00

19 lines
549 B
Common Lisp

(defvar *ht* (make-hash-table :test #'eq :weakness :key
:synchronized t))
(sb-ext:defglobal *stop* nil)
(with-test (:name :weak-hash-concurrency
:skipped-on (:not :sb-thread))
(let ((threads
(loop repeat 12
collect
(sb-thread:make-thread
(lambda ()
(loop
(setf (gethash (make-array 100) *ht*) 10)
(when *stop* (return))))))))
(sleep 1)
(setq *stop* t)
(mapc 'sb-thread:join-thread threads)))