The cmucl that never sleeps
There's something odd going on with ext:run-program
and sleep
. Please consider the following snippet (considerably reduced from what I started with):
#+clozure (use-package :ccl)
#+cmu (use-package :ext)
#+sbcl (use-package :sb-ext)
(time (sleep 5))
(let ((p (run-program "/usr/bin/env" '("sleep" "1") :wait nil)))
(declare (ignore p))
(time (sleep 5)))
For me, this prints:
; Evaluation took:
; 5.01 seconds of real time
; 0.0 seconds of user run time
; 0.0 seconds of system run time
; 16,479,138,228 CPU cycles
; 0 page faults and
; 0 bytes consed.
;
; Evaluation took:
; 1.02 seconds of real time
; 0.0 seconds of user run time
; 0.0 seconds of system run time
; 3,340,346,852 CPU cycles
; 0 page faults and
; 8 bytes consed.
;
But that doesn't make any sense. A 5-second sleep should always take 5 seconds. Somehow the background process is interfering with sleep
. The issue is with sleep
, not with time
here: The whole script returns a lot earlier than it should. With SBCL and Clozure CL, both sleeps take 5 seconds each.