[Openmcl-devel] Killing Threads Waiting on IO
Gary Byers
gb at clozure.com
Wed May 31 14:51:32 PDT 2006
I just tried:
? (dotimes (i 20) (process-run-function (format nil "thread ~d" i)
#'(lambda () (sleep (random 5.0)) (break))))
As expected, that yielded an environment in which 20 threads were
clamoring for terminal input.
Doing
? (:kill 3)
? (:kill 4)
...
? (:kill 21)
was a little tedious, but it worked as expected. (If I'd been a little
more industrious, I might have written a little loop that called
PROCESS-KILL on the right set of PROCESS objects.)
I don't -think- that the code that waits for and accepts the terminal
input lock is overly stateful (I don't think that things would get
confused if a waiting thread gets killed), but I wouldn't want to
claim that things are always as orderly as they seem to be in the
example above. I'm not sure (for instance) if The Right Thing would
happen if you :Y terminal input to a thread that's been interrupted by
a third party (and throws out of the break loop and no longer wants
terminal input), and there are timing screws (aka race conditions)
there.
Is this what you were asking, or do I misunderstand ?
On Wed, 31 May 2006, David L. Rager wrote:
> Howdy OpenMCL Dev,
>
> Does someone know of a way to kill the threads waiting for terminal input?
> I have about 20 or so, and since presumably their interrupts are disabled
> when they're waiting on the I/O semaphore, I'm having trouble killing them
> without killing the whole LISP.
>
> Thanks,
> David
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>
More information about the Openmcl-devel
mailing list