Hi Ashish,
It actually appears that there is no exception thrown by default when
future-cancel is called on the thread *unless* you manage to overlook java
functions that include some type of interrupt status handling. As I
managed to do.
Take a look at my below test-interrupt-status-2 that i
sInterrupted: false
user> (future-cancelled? (test-3 1))
true
user> @(test-3 0)
12
user> @(test-3 0)
13
user> (future-cancel (test-3 1))
false
user> (future-cancelled? (test-3 1))
true
On Thursday, April 28, 2016 at 11:48:29 AM UTC-4, Tom Bodenheimer wrote:
>
> Hi all,
Hi all,
I have recently been playing with futures and have stumbled on the
following situation.
(defn test-f1 [initial-v]
(let [n (atom initial-v)]
[n
(future (while (not (Thread/interrupted))
(Thread/sleep 5000)
(swap! n inc)
(println @n))