1 (defmacro assert-timeout (form)
2 (let ((ok (gensym "OK")))
8 (error "No timeout from form:~% ~S" ',form)))))
12 (sb-sys:with-deadline (:seconds 1)
13 (run-program "sleep" '("3") :search t :wait t)))
18 (handler-bind ((sb-sys:deadline-timeout (lambda (c)
21 (sb-sys:defer-deadline 0.1 c)))))
22 (sb-sys:with-deadline (:seconds 1)
23 (run-program "sleep" '("2") :search t :wait t)))
24 (sb-sys:deadline-timeout (c)
32 (handler-bind ((sb-sys:deadline-timeout (lambda (c)
34 (sb-sys:defer-deadline 0.1 c))))
35 (sb-sys:with-deadline (:seconds 1)
36 (run-program "sleep" '("2") :search t :wait t)))
37 (sb-sys:deadline-timeout (c)
42 #+(and sb-thread (not sb-lutex))
45 (let ((lock (sb-thread:make-mutex))
47 (sb-thread:make-thread (lambda ()
48 (sb-thread:get-mutex lock)
51 (loop while waitp do (sleep 0.01))
52 (sb-impl::with-deadline (:seconds 1)
53 (sb-thread:get-mutex lock))))
56 (let ((sem (sb-thread::make-semaphore :count 0)))
57 (sb-impl::with-deadline (:seconds 1)
58 (sb-thread::wait-on-semaphore sem))))
61 (sb-impl::with-deadline (:seconds 1)
62 (sb-thread:join-thread
63 (sb-thread:make-thread (lambda () (loop (sleep 1))))))))