[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOCKS: What I want in R^5RS



re:   (try-lock lck)				procedure

    Returns #t if you now own the lock, #f otherwise.  Lck will be locked
    if it is not already.

    I did not find anything in the literature like try-lock . . . 

In Lucid Comomn Lisp, the lock acquisition primitive -- PROCESS-LOCK --
when used in conjunction with one of the keyword options, has this property.

Earlier this year, we beefed up the commonly used macro that provides a 
dynamic-scoping for multitasking interlocks -- WITH-PROCESS-LOCK  -- so 
that it has virtually no overhead when you already own the lock.  Thus it 
is always "efficient" just to do

   (with-process-lock (some-lock)  <<hack-it-out>>)

rather than some cumbersome probing about the ownership of "some-lock".

[Additionally, WITH-PROCESS-LOCK was "beefed up" to take the same kinds 
of keyword arguments that PROCESS-LOCK has, to provide graceful escape 
in the situations that lead to mututal lockouts.  But I digress.]



-- JonL --