Randall Randall | 27 Jun 2004 05:46

simple locking

This is intended to be a simple locking protocol for
systems that need to be usable on both serve-event-only
systems, like CMUCL on PPC, and more ordinary
multi-processing systems.  I'm currently using it as
part of PSILISP, my webapp framework.

This seems to work, and people I've run it by agree
that it seems to work, but there could be some serious
problem with it, so use at your own risk.  I am only
an egg.

(defmacro enqueue (queue)
   "Appends a unique ID to a queue."
   (let ((id (gensym)))
     `(let ((,id (gensym)))
        (setf ,queue (append ,queue (list ,id)))
        ,id)))

(defmacro lock (queue)
   "Waits in turn in the activity queue until all previous members have 
exited."
   (let ((id (gensym)))
     `(let* ((,id (enqueue ,queue)))
        #+(and acl-compat (not allegro) (not cmu))  ; CMUCL on PPC 
doesn't have MP, so we have to use serve-event
        (ACL-COMPAT.MP:process-wait "waiting for lock" #'eq ,id (car 
,queue))
        #+allegro
        (MP:process-wait "waiting for lock" #'eq ,id (car ,queue))
        #+cmu
(Continue reading)

Randall Randall | 27 Jun 2004 06:01

Re: simple locking


On Jun 26, 2004, at 11:46 PM, Randall Randall wrote:

And, of course, I sent to the wrong one.

My apologies.

--
Randall Randall <randall <at> randallsquared.com>
Property law should use #'EQ , not #'EQUAL .

Gmane