The Multitasking Facility signals an error whenever a process attempts to acquire a lock while scheduling is inhibited or while interrupts are deferred. To prevent such potential deadlock errors, processes should not acquire locks while scheduling is either explicitly inhibited, by a call to the macro
with-scheduling-inhibited, or implicitly inhibited. The following guidelines should help you avoid deadlocks:
process-allow-schedulewhile scheduling is inhibited. Since calling
process-wait, do not use the locking functions while scheduling is inhibited.
with-io-unlockedaround the method body.
;;; Incorrect way to make sure windows do not move around between ;;; locating the window and drawing on it. (with-scheduling-inhibited (let ((window (find-topmost-window))) (draw-on-window window)))To prevent processes from waiting forever for a lock, use the
;;; Correct way; the code inside WITH-SCHEDULING-INHIBITED will ;;; always be able to acquire the lock. (with-window-system-lock (with-scheduling-inhibited (let ((window (find-topmost-window))) (draw-on-window window))))
:actionkeyword argument to
with-process-lockor the action argument to
process-lockto specify the action a process should take if a requested lock is already held by another process.
Generated with Harlequin WebMaker