arc> (= val nil)
nil
arc> (def test (x) (atomic-invoke (fn () (sleep 300) (= val x))))
#<procedure: test>
arc> (= thr (thread (test 1)))
#<thread: thr>
sometime before the five-minute wait in test finishes arc> (kill-thread thr)
about five minutes later... #<void>
arc> val
1
It seems that kill-thread didn't actually kill anything. If it did, then val should still be nil. Instead, it seems that kill-thread actually made my REPL join the thread instead of killing it! It made my REPL wait for the remainder of the five-minute sleep and then set val to 1. Apparently break-thread does exactly the same thing.Removing the atomic-invoke in test so it looks like (def test (x) (do (sleep 300) (= val x)))
appears to make kill and break do what one might think. I don't think I want to duplicate this sort of behavior in Arcueid... |