All Manuals > LispWorks User Guide and Reference Manual > 15 Multiprocessing > 15.2 The process programming interface > 15.2.8 Values across processes

NextPrevUpTopContentsIndex

15.2.8.1 Returning a value from another process

Rather than using global variables to pass values between processes, you can use closures instead. For example:

(defun send-with-result (process function)
  (let ((remote-result :none))
    (flet ((resultp ()
             (listp remote-result))
           (run-it ()
             (setq remote-result
                   (multiple-value-list (funcall function)))))
      (mp:process-send process (list #'run-it))
      (mp:process-wait "Waiting for result" #'resultp)
      (values-list remote-result))))

LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex