All Manuals > LispWorks User Guide and Reference Manual > 15 Multiprocessing > 15.2 The process programming interface > 15.2.6 Old interrupt blocking APIs removed

NextPrevUpTopContentsIndex

15.2.6.3 Atomic push/delete

Old:

(without-interrupts
 (push value *global-list*))
     (without-interrupts
      (setq *global-list* (delete value *global-list*)))

New: use a lock, because delete cannot be done atomically since it reads more than one object before modifying one of them.

(defvar *global-list-lock* (mp:make-lock :name "Global List"))
 
(mp:with-lock (*global-list-lock*)
	      (push value *global-list*))
 
(mp:with-lock (*global-list-lock*)
	      (setq *global-list* (delete value *global-list*)))

LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex