(in-package :cl-user) #+NIL (defun foo () (let ((cv (bt:make-condition-variable)) (lk (bt:make-lock)) (k 0) (t1 0)) (prin1 `(internal-time-units-per-second = ,internal-time-units-per-second)) (terpri) (let ((s *standard-output*)) (bt:make-thread (lambda () (let ((*standard-output* s)) (loop (bt:with-lock-held (lk) (bt:condition-wait cv lk) (prin1 (list k (* 1s0 (/ (- (get-internal-real-time) t1) internal-time-units-per-second))))) (terpri) (force-output)))))) (sleep 1) (dotimes (i 10) (setq t1 (get-internal-real-time)) (bt:with-lock-held (lk) (incf k) (bt:condition-notify cv)) (sleep 10)))) #+CCL (defun foo () (prin1 `(internal-time-units-per-second = ,internal-time-units-per-second)) (terpri) (force-output) (let ((sem (ccl:make-semaphore)) (t1 0) (k 0)) (let ((s *standard-output*)) (ccl:process-run-function 'aux (lambda () (let ((*standard-output* s)) (loop (ccl:wait-on-semaphore sem) (format t "~&K = ~D; latency ~Ds~%" k (* 1s0 (/ (- (get-internal-real-time) t1) internal-time-units-per-second))) (force-output)))))) (sleep 1) (dotimes (i 10) (setq t1 (get-internal-real-time)) (incf k) (ccl:signal-semaphore sem) (prin1 `(sleep ,(expt 1.4 i))) (terpri) (force-output) (sleep (expt 1.4 i))) nil)) #+SBCL (defun foo () (prin1 `(internal-time-units-per-second = ,internal-time-units-per-second)) (terpri) (force-output) (let ((sem (SB-THREAD:MAKE-SEMAPHORE)) (t1 0) (k 0)) (let ((s *standard-output*)) (sb-thread:make-thread (lambda () (let ((*standard-output* s)) (loop (sb-thread:wait-on-semaphore sem) (format t "~&K = ~D; latency ~Ds~%" k (* 1s0 (/ (- (get-internal-real-time) t1) internal-time-units-per-second))) (force-output)))))) (sleep 1) (dotimes (i 10) (setq t1 (get-internal-real-time)) (incf k) (sb-thread:signal-semaphore sem) (prin1 `(sleep ,(expt 1.4 i))) (terpri) (force-output) (sleep (expt 1.4 i))) nil)) (foo)