Lisp HUG Maillist Archive

LispWorks 6.0.1 Semaphore issue

Hello!
we've had a hard time making LispWorks semaphores work.
Please consider the following code:

(defvar *sem*)

(defun test ()
   (setf *sem* (mp:make-semaphore))
   (dotimes (x 3)
     (mp:process-run-function (format nil "process ~s" x)
                              '()
                              (lambda ()
                                (loop
                                 (mp:semaphore-acquire *sem*)
                                 (mp:semaphore-release *sem*))))))

The test function should create 3 processes and allow only one to enter 
the critical section and make the other two wait.
However, after few iterations all three processes stop at 
(mp:semaphore-acquire *sem*) and are waiting for the semaphore and none 
of them continues into the critical section.
We tried to inspect the semaphore stored in *sem* and there was -1 in 
slot MP::FREE-COUNT - we believe that this slot should contain 
non-negative integers only.

We are using LispWorks 6.0.1 Personal on Windows 7 and on MacOS X.

Have you encountered such behavior? Is it possibly a bug in LispWorks?

Thank you very much for your time.
Andrew


Re: LispWorks 6.0.1 Semaphore issue

Unable to parse email body. Email id is 10944

Updated at: 2020-12-10 08:38 UTC