Juho Snellman <jsnell@...> writes:
> Fix DEFUN-CACHED thread/interrupt-safety issues. It was
> possible for FOO-CACHE-ENTER to modify a region in the cache
> vector while FOO-CACHE-LOOKUP had only partially read it.
> * Instead of storing all the data in one vector, the main
> cache vector will only contain references to bucket vectors,
> which contain the real data. FOO-CACHE-ENTER will always
> allocate a new bucket, old buckets are never modified. Thus
> FOO-CACHE-LOOKUP consistently sees either a pre- or post-
> FOO-CACHE-ENTRY state.
> Index: timer.impure.lisp
> RCS file: /cvsroot/sbcl/sbcl/tests/timer.impure.lisp,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -d -r1.5 -r1.6
> --- timer.impure.lisp 13 Sep 2006 21:37:29 -0000 1.5
> +++ timer.impure.lisp 2 Nov 2006 11:17:56 -0000 1.6
> @@ -140,3 +140,21 @@
> (assert t))))
> (sleep 6)
> (assert t))
> +(defun random-type (n)
> + `(integer ,(random n) ,(+ n (random n))))
> +(with-test (:name '(:hash-cache :interrupt))
> + (let* ((type1 (random-type 500))
> + (type2 (random-type 500))
> + (wanted (subtypep type1 type2)))
> + (dotimes (i 100)
> + (block foo
> + (sb-ext:schedule-timer (sb-ext:make-timer
> + (lambda ()
> + (assert (eq wanted (subtypep type1 type2)))
> + (return-from foo)))
> + 0.05)
> + (loop
> + (assert (eq wanted (subtypep type1 type2))))))))
Since timeouts don't work currently on win32 this test loops forever.
I'm not sure if it should be #-win32'ed for 1.0 or not. Definitely not
critical, but perhaps worse press then even the experimental status of
the port deserves.
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."