Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2005

Tip: Looking for answers? Try searching our database.

"Thread has been interrupted from a waiting state"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ross J. Micheals - 04 Aug 2005 17:07 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.