X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Ftimer.impure.lisp;h=734d810829820c85206fa0a62bbad9ebb10bb470;hb=HEAD;hp=a610eb999a0b8d8256a37de0a54e7e402124e953;hpb=69fe69971242dba6905e9c55f8ce6a9a93c9e403;p=sbcl.git diff --git a/tests/timer.impure.lisp b/tests/timer.impure.lisp index a610eb9..734d810 100644 --- a/tests/timer.impure.lisp +++ b/tests/timer.impure.lisp @@ -114,7 +114,7 @@ (assert (zerop (length (sb-impl::%pqueue-contents sb-impl::*schedule*)))))) (with-test (:name (:timer :other-thread) :skipped-on '(not :sb-thread)) - (let* ((thread (sb-thread:make-thread (lambda () (sleep 2)))) + (let* ((thread (make-kill-thread (lambda () (sleep 2)))) (timer (make-timer (lambda () (assert (eq thread sb-thread:*current-thread*))) :thread thread))) @@ -196,7 +196,8 @@ (defun wait-for-threads (threads) (loop while (some #'sb-thread:thread-alive-p threads) do (sleep 0.01))) -(with-test (:name (:with-timeout :many-at-the-same-time) :skipped-on '(not :sb-thread)) +(with-test (:name (:with-timeout :many-at-the-same-time) + :skipped-on '(not :sb-thread)) (let ((ok t)) (let ((threads (loop repeat 10 collect (sb-thread:make-thread @@ -214,7 +215,7 @@ (assert ok)))) (with-test (:name (:with-timeout :dead-thread) :skipped-on '(not :sb-thread)) - (sb-thread:make-thread + (make-join-thread (lambda () (let ((timer (make-timer (lambda ())))) (schedule-timer timer 3) @@ -245,7 +246,9 @@ ;;; Used to hang occasionally at least on x86. Two bugs caused it: ;;; running out of stack (due to repeating timers being rescheduled ;;; before they ran) and dying threads were open interrupts. -(with-test (:name (:timer :parallel-unschedule) :fails-on :ppc :skipped-on '(not :sb-thread) :broken-on '(or :darwin :ppc)) +(with-test (:name (:timer :parallel-unschedule) + :skipped-on '(not :sb-thread) + :broken-on ':ppc) (let ((timer (sb-ext:make-timer (lambda () 42) :name "parallel schedulers")) (other nil)) (flet ((flop () @@ -295,7 +298,11 @@ #-sb-thread (loop repeat 10 do (test)))) -(with-test (:name (:timer :threaded-stress) :skipped-on '(not :sb-thread)) +(with-test (:name (:timer :threaded-stress) + :skipped-on '(not :sb-thread) + :fails-on :win32) + #+win32 + (error "fixme") (let ((barrier (sb-thread:make-semaphore)) (goal 100)) (flet ((wait-for-goal () @@ -319,3 +326,29 @@ (dolist (thread threads) (sched thread))) (mapcar #'sb-thread:join-thread threads))))) + +;; SB-THREAD:MAKE-THREAD used to lock SB-THREAD:*MAKE-THREAD-LOCK* +;; before entering WITHOUT-INTERRUPTS. When a thread which was +;; executing SB-THREAD:MAKE-THREAD was interrupted with code which +;; also called SB-THREAD:MAKE-THREAD, it could happen that the first +;; thread already owned SB-THREAD:*MAKE-THREAD-LOCK* and the +;; interrupting code thus made a recursive lock attempt. A timer with +;; :THREAD T or :THREAD could +;; also trigger this problem. +;; +;; See (MAKE-THREAD :INTERRUPT-WITH MAKE-THREAD :BUG-1180102) in +;; threads.pure.lisp. +(with-test (:name (:timer :dispatch-thread :make-thread :bug-1180102) + :skipped-on '(not :sb-thread)) + (flet ((test (thread) + (let ((timer (make-timer (lambda ()) :thread thread))) + (schedule-timer timer .01 :repeat-interval 0.1) + (dotimes (i 100) + (let ((threads '())) + (dotimes (i 100) + (push (sb-thread:make-thread (lambda () (sleep .01))) + threads)) + (mapc #'sb-thread:join-thread threads))) + (unschedule-timer timer)))) + (test t) + (test sb-thread:*current-thread*)))