#77: Add JOIN-PROCESS -------------------------+-------------------------------------------------- Reporter: sionescu | Owner: somebody Type: enhancement | Status: new Priority: major | Milestone: Component: Core | Version: 2013-03-a Keywords: | -------------------------+-------------------------------------------------- There should be a JOIN-PROCESS function that waits for a process to complete and returns its return value.
The current implementation in Bordeaux-Threads uses (mp:process-wait "..." (lambda () (not (mp:process-alive-p process)))), but that doesn't fulfill the second requirement.
#77: Add JOIN-PROCESS -------------------------+-------------------------------------------------- Reporter: sionescu | Owner: somebody Type: enhancement | Status: new Priority: major | Milestone: Component: Core | Version: 2013-03-a Keywords: | -------------------------+--------------------------------------------------
Comment(by sionescu):
I added a workaround to Bordeaux-Threads, but it would be better to have this functionality in CMUCL itself:
{{{ (defun %make-thread (function name) (mp:make-process (lambda () (let ((return-values (multiple-value-list (funcall function)))) (setf (getf (mp:process-property-list mp:*current- process*) 'return-values) return-values) (values-list return-values))) :name name))
(defun join-thread (thread) (mp:process-wait (format nil "Waiting for thread ~A to complete" thread) (lambda () (not (mp:process-alive-p thread)))) (let ((return-values (getf (mp:process-property-list thread) 'return-values))) (values-list return-values))) }}}
#77: Add JOIN-PROCESS --------------------------+------------------------------------------------- Reporter: sionescu | Owner: somebody Type: enhancement | Status: closed Priority: major | Milestone: Component: Core | Version: 2013-03-a Resolution: fixed | Keywords: --------------------------+------------------------------------------------- Changes (by toy.raymond@…):
* status: new => closed * resolution: => fixed
Comment:
commit 0232d2242e5acf9d1654cd0e4d7883de9e9f4705 Author: Raymond Toy toy.raymond@gmail.com Date: Sun Mar 24 09:43:33 2013 -0700
Fix ticket:77 by adding the code given in the ticket.
#77: Add JOIN-PROCESS --------------------------+------------------------------------------------- Reporter: sionescu | Owner: somebody Type: enhancement | Status: reopened Priority: major | Milestone: Component: Core | Version: 2013-03-a Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by sionescu):
* status: closed => reopened * resolution: fixed =>
Comment:
Sorry I didn't specify that the code included was copied verbatim from Bordeaux-Threads. I make a proper patch available at https://github.com/sionescu/cmucl/commit/520441523f317e2c72c44c1d33516c3c0ce...
#77: Add JOIN-PROCESS --------------------------+------------------------------------------------- Reporter: sionescu | Owner: somebody Type: enhancement | Status: closed Priority: major | Milestone: Component: Core | Version: 2013-03-a Resolution: fixed | Keywords: --------------------------+------------------------------------------------- Changes (by toy.raymond@…):
* status: reopened => closed * resolution: => fixed
Comment:
commit c94b32f927061d6e7b7ea1ebf92ccdb4c3b1a842 Author: Raymond Toy toy.raymond@gmail.com Date: Sun Mar 24 20:13:56 2013 -0700
Fix ticket:77 correctly, using the supplied patch link.