5.2 Issues in multitasking
nil
, no process is using the data structure; otherwise, the value should be a process that is currently using the data structure. Any process that wants to modify the data structure must acquire a lock; that is, it must wait until the value stored in the lock location isnil
and then set the value of the location to itself. If the lock location is held by another process, the process must wait until the location becomesnil
. Note that locks only work if all processes that modify a data structure use them. The lock by itself guarantees nothing.
The Multitasking Facility provides three macros for acquiring and releasing locks:
process-lock process-unlock with-process-lockThe macro
with-process-lock
temporarily secures a lock while a series of forms are executed; it then releases the lock. The macros process-lock
andprocess-unlock
provide finer control over locks. Note: You cannot run the Compiler if another process is using it. If you attempt to do so, your process will wait until the first process is finished using the Compiler. See the reference page for with-process-lock
for a description of the behavior of locked processes.
Generated with Harlequin WebMaker