Grain of Salt - [entries|archive|friends|userinfo]
snauts

[ userinfo | sc userinfo ]
[ archive | journal archive ]

[Aug. 24th, 2009|11:04 am]
Previous Entry Add to Memories Tell A Friend Next Entry
(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))
linkpost comment