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

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

Aug. 24th, 2009|11:04 am

snauts
(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))
link Read Comments

Reply:
From:
Username:
Password:
Ievadi te 'qws' (liidzeklis pret spambotiem):
Subject:
No HTML allowed in subject
  
Message:

Notice! This user has turned on the option that logs IP addresses of anonymous posters.