| kill-thread doesn't respect atomic, so the dead thread can be left holding the atomic semaphore. Other threads will then block forever the first time they try to perform assignment. arc> (= l (thread:atomic (while t)))
#<thread: l>
arc> (= a nil)
nil
arc> (kill-thread l)
#<void>
arc> (dead l)
t
arc> (push 3 a)
;; hangs
Reading the mzscheme docs, it seems to me that kill-thread respects scheme's guarantees of atomicity. But arc simulates its own atomic, which has slipped through the cracks.The use case for kill-thread is a timeout macro that runs a computation for some time and then stops it. I don't see how to fix kill-thread without completely changing how atomic is implemented. I thought of recording which thread holds the semaphore, but there's no way to 'break' a semaphore within kill-thread, is there? |