<div dir="ltr"><div><div><div><div><div><div>Consider this code snippet which demonstrates a "futures" package for executing computations asynchronously:<br><br>(setf e (futures:make-pool-executor 2))<br>(setf f1 (futures:executor-submit e #'(lambda (x) (* x 2)) 100))<br>
(setf f2 (futures:executor-submit e #'(lambda (x y) (+ x y)) 200 300))<br>(format t "~A~%" (futures:future-result f1))<br>(format t "~A~%" (futures:future-result f2))<br>(futures:executor-shutdown e nil)<br>
<br></div>`pool-executor' internally uses a pool of ccl threads for executing the jobs<br>submitted to it. Now if I rewrite the same sample using `let' bindings, the<br>call to `future-result' just hangs. The threads actually run, but it seems<br>
</div>`future-result' somehow do not see the updated value of the internal `result' slot.<br><br></div>If I load this script, it just hangs the CCL REPL:<br><br>(let ((e (futures:make-pool-executor 2)))<br> (let ((f1 (futures:executor-submit e #'(lambda (x) (* x 2)) 100))<br>
(f2 (futures:executor-submit e #'(lambda (x y) (+ x y)) 200 300)))<br> (format t "~A~%" (futures:future-result f1))<br> (format t "~A~%" (futures:future-result f2))<br> (futures:executor-shutdown e nil)))<br>
</div><div><br></div><div>Also I would like to learn about the best way to debug programs that use CCL threads.<br><br></div>I am new to Common Lisp and the kind of support I am getting from this <br>mailing list is very encouraging!<br>
<br></div>Thank you,<br><br></div>--Vijay<br><div><div><div><br></div></div></div></div>