From: Tobias C. R. <tc...@fr...> - 2010-03-23 09:00:14
|
(with-test (:name (:condition-variable :wait-multiple)) (loop repeat 40 do (let ((waitqueue (sb-thread:make-waitqueue :name "Q")) (mutex (sb-thread:make-mutex :name "M")) (failedp nil)) (format t ".") (finish-output t) (let ((threads (loop repeat 200 collect (sb-thread:make-thread (lambda () (handler-case (sb-sys:with-deadline (:seconds 0.01) (sb-thread:with-mutex (mutex) (sb-thread:condition-wait waitqueue mutex) (setq failedp t))) (sb-sys:deadline-timeout (c) (declare (ignore c))))))))) (mapc #'sb-thread:join-thread threads) (assert (not failedp)))))) The test case is bogus because it does not account for spurious wakeups in CONDITION-WAIT. With the current code (which uses NIL as futex token in CONDITION-WAIT), spurious wakeups may only come due to the futex() syscall returning EINTR -- I can't judge whether that's really impossible in the above code, but it's highly unlikely at least. Using NIL as futex token is a bug though (as I depicted in the "lost wakeup" threads of the last month) -- and fixing it, will make spurious wakeups less unlikely--making this test case fail almost reliably on a highly parallel machine. -T. |