Function
create-simple-process name function wait-function &key
function-arguments wait-function-arguments
priority => process
mp
A string or symbol
A function
A function
A list of arguments for function
A list of arguments for wait-function
A fixnum
A simple process
create-simple-process function creates and returns a simple process, which is a process that has no stack of its own. *default-simple-process-priority*, and is usually 0. nil, the process function is applied to the function-arguments. The process function is executed insidean mp:without-preemption form. If an error occurs in a simple process, that process is stopped and a continuable error is signaled in the process that was running at the time the simple process was started (or the last process to run if the system was idle). Continuing from the error restarts the simple process. mp:mailbox-read (with an empty mailbox)mp:process-allow-schedulingmp:process-lockmp:process-waitmp:process-wait-with-timeoutcl:sleepmp:sleep-for-timemp:wait-for-mailboxmp:with-lock(setf gethash) on a hash table that another process is mapping over. *a* to the background output when the value is other thannil. The process function then sets *a* tonil. From a listener, the value of *a* can be set to trigger the process to run once and then sleep again.
(defvar *a* 'i)
*A*
(defun a ()
(let ((a *a*))
(setq *a* nil)
(format mp:*background-standard-output*
"*a* is ~a~%" a)))
A
(defun b () *a*)
B
(setq r (mp:create-simple-process 'test-proc 'a 'b))
#<MP::SIMPLE-PROCESS Name TEST-PROC Priority 0 State NIL>