OpenMCL 1.0 timed-wait-on-semaphore not timing out
Lennart Staflin <[email protected]> Fri, 27 Jan 2006 17:53:58 +0100
| Newsgroups | gmane.lisp.openmcl.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have run into an occasional problem with timed-wait-on-semaphore.
This is a problem in 1.0 in 0.14 it worked well. It seems that
occasionally timed-wait-on-semaphore will hang or take much longer to
time out then is should.
Test case below, it should print something every 5 minutes. When I run
it it seldom gets past 40 iterations usually it hangs earlier. The
machine is an iBook. At first I thought the sleep had something to do
with the hang. But I observe the hang even when on external power (and
it usually don't sleep then). Testing this takes time and I'm not at
the machine all the time, i can't be 100% sure if my observations are
accurate. (Hmm, I wonder if using a shorter timeout will trigger the
hang earlier.)
//Lennart Staflin
(in-package :cl-user)
(defvar *sem* (make-semaphore))
(defun format-date (date &optional include-time)
(if date
(multiple-value-bind (second minute hour date month year)
(decode-universal-time date)
(if include-time
(format nil "~d-~2,'0d-~2,'0d ~2,'0d:~2,'0d:~2,'0d"
year month date hour minute second)
(format nil "~d-~2,'0d-~2,'0d" year month date)))
"--"))
(defun format-time (universal-time) (format-date universal-time t))
(defun test-bug-1 ()
(loop for i from 1 to 1000
do (progn (format t "~A Looping ~A~%"
(format-time (get-universal-time))
i)
(force-output)
(timed-wait-on-semaphore *sem* 300))) )