|
Aug. 24th, 2009|11:04 am |
(defmacro funcall-concurrent (name &rest args)
`(apply ,name
(mapcar (lambda (thread-id)
(sb-thread:join-thread thread-id))
(mapcar (lambda (exp)
(sb-thread:make-thread #'(lambda () (eval exp))))
',args))))
(defun orgy (str x) ; returns x
(dotimes (i x x)
(format t "~A ~A~%" str i)
(sleep (/ 1.0 x))))
(funcall-concurrent #'* (orgy "porgy" 13) (orgy "shmorgy" 12))
|
|