I noticed that when calling .Interrupt() & .Join on a sleeping thread, a
ThreadInterruptedException with the message "Thread has been interrupted from
a waiting state." gets thrown.
A few questions about this phenomenon:
(1) What is the technical reason for throwing such an exception? If a thread
is asleep, why shouldn't it be interuptable?
(2) Is there a way to interrupt this thread without this exception? If not,
then where can I catch this exception so that it doesn't propogate up the
stack to an unexpected place?
Note that for my given application resorting to using a shared monitor or
boolean to signal interupption is not an option.
Thanks in advance for your help.
Brian Delahunty - 04 Aug 2005 22:21 GMT
Just warp the call that makes the thread Sleep in a Try-Catch that catches
that exception.
> I noticed that when calling .Interrupt() & .Join on a sleeping thread, a
> ThreadInterruptedException with the message "Thread has been interrupted from
[quoted text clipped - 13 lines]
>
> Thanks in advance for your help.
Ross J. Micheals - 14 Sep 2005 17:22 GMT
This is true, but it does not answer my original questions.
> Just warp the call that makes the thread Sleep in a Try-Catch that catches
> that exception.
[quoted text clipped - 16 lines]
> >
> > Thanks in advance for your help.