(sb-ext:with-timeout 0.1 (sleep 1) t))))
(sb-ext:timeout ()
nil))))
-
-(with-test (:name :sleep-many-interrupts)
- (let ((n 0)
- (timer nil))
- (flet ((trip ()
- (when (< (incf n) 5)
- (sleep 0.1)
- (schedule-timer timer 0.1))))
- (setf timer (make-timer #'trip))
- (schedule-timer timer 0.1)
- (let ((start (get-internal-real-time)))
- (sleep 1.5)
- (let ((ticks (/ (float (- (get-internal-real-time) start))
- internal-time-units-per-second)))
- (assert (< 1.4 ticks 1.6))
- (assert (= n 5)))))))