A string.
A generalized boolean.
A generalized boolean.
A generalized boolean.
A generalized boolean.
make-lock
creates a lock object. See Locks for a general description of locks.
name
names the lock and can be queried with
mp:lock-name
. The default value of
name
is "Anon".
important-p
controls whether the lock is automatically freed when the holder process finishes. When
important-p
is true, the system notes that this lock is important, and automatically frees it when the holder process finishes.
important-p
should be
nil
for locks which are managed completely by the application, as it is wasteful to record all locks in a global list if there is no need to free them automatically. This might be appropriate when two processes sharing a lock must both be running for the system to be consistent. If one process dies, then the other one kills itself. Thus the system does not need to worry about freeing the lock because no process could be waiting on it forever after the first process dies. The default value of
important-p
is
nil
.
safep
controls whether the lock is safe. A safe lock gives an error if process-unlock is called on it when it is not locked by the current process, and potentially in other 'dangerous' circumstances. An unsafe lock does not signal these errors. The default value of
safep
is
t
.
recursivep
, when true, allows the lock to be locked recursively. Trying to lock a lock that is already locked by the current thread just increments its lock count. If the lock is created with
recursivep
nil
then trying to lock again causes an error. This is useful for debugging code where the lock is never expected to be claimed recursively. The default value of
recursivep
is
t
.
sharing , when true, causes lock to be a "sharing" lock object, which supports sharing and exclusive locking. At any given time, an sharing lock may be free, or it may be locked for sharing by any number of threads or locked for exclusive use by a single thread. Sharing locks are handled by different functions and methods from non-sharing locks.
CL-USER 3 > (setq *my-lock* (mp:make-lock
:name "my-lock"))
#<MP:LOCK "my-lock" Unlocked 2008CAC7>
CL-USER 4 > (mp:process-lock *my-lock*)
T
CL-USER 5 > *my-lock*
#<MP:LOCK "my-lock" Locked once by "CAPI Execution Listener 1" 2008CAC7>
CL-USER 6 > (mp:process-lock *my-lock*)
T
CL-USER 7 > *my-lock*
#<MP:LOCK "my-lock" Locked 2 times by "CAPI Execution Listener 1" 2008CAC7>
create-simple-process
lock-recursive-p
process-lock
process-unlock
schedule-timer
with-lock