基本上我有以下片段,
(let [task (FutureTask. fn)
thr (Thread. task)]
(.start thr)
;;wait for signal...
(.cancel task true)
(.stop thr))
问题是偶尔取消不起作用,AFAICT 取消导致并引发异常,但是下面的一些代码捕获了它?有没有确定的方法可以取消未来的任务?
fn 是一个基本上执行一系列长时间运行计算的函数,因此我无法循环检查布尔标志。