• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

what is happening here

 
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wanted to see what would happen when an object is blocked and inetrrupt method is called on the thread. I made this program. Now I don't understand why it's behaving the way its behaving. On my PC it simply hangs there for a while and after a few seconds gives an error. Is this program doing the same acts on your computer. Can anyone tell me whats happening and how to tame it. It would be great if I also can get a program that causes a runtime error to occur because interrupt was called and the thread was blocked. But the should be because the thread was blocked and only blocked not waiting and not sleeping. One more thing can I call thread.setPriority() after the call to thread.start().
well here goes my wild code :

[ May 17, 2003: Message edited by: Anupam Sinha ]
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the interrupt method is invoked on a thread that is sleeping or waiting then an InterruptedException is thrown. If the thread is not in the not-runnable state, then the thread won't know that it has been interrupted unless it checks the isInterrupted method.
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic