All Manuals > LispWorks User Guide and Reference Manual > 15 Multiprocessing > 15.5 Process Waiting


15.5.3 Communication between processes and synchronization

The simplest way to pass a specific event between two processes it to use process-wait-for-event on the receiving process, and process-send on the sender side. The "event" that is passed is can be any Lisp object.

process-send and process-wait-for-event use a mp:mailbox to pass the object (the process-mailbox of the receiver). It is possible to use a mp:mailbox object directly, and to communicate between multiple senders and receivers. Use make-mailbox to make a mailbox, and mailbox-send to put a message in it. The receiver(s) use either mailbox-wait-for-event and mailbox-read.

mailbox-wait-for-event should be used on processes that may make windows (including any process associated with a CAPI interface), but can be used elsewhere. mailbox-read is faster, but if it used on a process with a window it may cause hanging.

process-wait-for-event and process-send and mp:mailbox are the primary interface for communication between processes, and should be used unless there is a very good reason to use a different mechanism.

LispWorks User Guide and Reference Manual - 21 Dec 2011