G
Guest
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.
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.