close Warning: Can't synchronize with repository "(default)" (/project/cmucl/public_html/git/cmucl.git does not appear to be a Git repository.). Look in the Trac log for more information.

Opened 7 years ago

Closed 6 years ago

#77 closed enhancement (fixed)


Reported by: sionescu Owned by: somebody
Priority: major Milestone:
Component: Core Version: 2013-03-a
Keywords: Cc:


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.

Change History (4)

comment:1 Changed 7 years ago 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*)
                       (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)))

comment:2 Changed 6 years ago by toy.raymond@…

Resolution: fixed
Status: newclosed

commit 0232d2242e5acf9d1654cd0e4d7883de9e9f4705 Author: Raymond Toy <toy.raymond@…> Date: Sun Mar 24 09:43:33 2013 -0700

Fix ticket:77 by adding the code given in the ticket.

comment:3 Changed 6 years ago by sionescu

Resolution: fixed
Status: closedreopened

Sorry I didn't specify that the code included was copied verbatim from Bordeaux-Threads. I make a proper patch available at

comment:4 Changed 6 years ago by toy.raymond@…

Resolution: fixed
Status: reopenedclosed

commit c94b32f927061d6e7b7ea1ebf92ccdb4c3b1a842 Author: Raymond Toy <toy.raymond@…> Date: Sun Mar 24 20:13:56 2013 -0700

Fix ticket:77 correctly, using the supplied patch link.

Note: See TracTickets for help on using tickets.