X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fdeadline.impure.lisp;h=5d24ec9ad6690c4eaa92a40fa92e9e2ab6dc79c3;hb=b76dac3d5f89700f3a076403157eae3c52e4c118;hp=9d0b4f97962e7811078b77d5ec1541bb57e258b6;hpb=682b7487bec22dd9a2994d9de4307a1c4418bb78;p=sbcl.git diff --git a/tests/deadline.impure.lisp b/tests/deadline.impure.lisp index 9d0b4f9..5d24ec9 100644 --- a/tests/deadline.impure.lisp +++ b/tests/deadline.impure.lisp @@ -9,8 +9,35 @@ (assert-timeout - (sb-impl::with-deadline (:seconds 1) - (run-program "sleep" '("5") :search t :wait t))) + (sb-sys:with-deadline (:seconds 1) + (run-program "sleep" '("3") :search t :wait t))) + +(let ((n 0) + (final nil)) + (handler-case + (handler-bind ((sb-sys:deadline-timeout (lambda (c) + (when (< n 2) + (incf n) + (sb-sys:defer-deadline 0.1 c))))) + (sb-sys:with-deadline (:seconds 1) + (run-program "sleep" '("2") :search t :wait t))) + (sb-sys:deadline-timeout (c) + (setf final c))) + (assert (= n 2)) + (assert final)) + +(let ((n 0) + (final nil)) + (handler-case + (handler-bind ((sb-sys:deadline-timeout (lambda (c) + (incf n) + (sb-sys:defer-deadline 0.1 c)))) + (sb-sys:with-deadline (:seconds 1) + (run-program "sleep" '("2") :search t :wait t))) + (sb-sys:deadline-timeout (c) + (setf final c))) + (assert (plusp n)) + (assert (not final))) #+(and sb-thread (not sb-lutex)) (progn