Grain of Salt - August 24th, 2009 [entries|archive|friends|userinfo]
snauts

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

August 24th, 2009

[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))
linkpost comment

navigation
[ viewing | August 24th, 2009 ]
[ go | Previous Day|Next Day ]