interrupt « Thread Safe « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » Thread Safe » interrupt 

1. What happens when you invoke a thread's interrupt()?    stackoverflow.com

I need to know what happens

  1. when it is sleeping?
  2. when it is running i.e., it is executing the given task.
Thanks in advance.

2. Calling Thread.sleep() with *interrupted status* set?    stackoverflow.com

The Java documentation is not clear on this point. What happens if you call interrupt on a Thread before it calls Thread.sleep():

        //interrupt reaches ...

3. why interrupt() not work as expected and how does it work    stackoverflow.com

I want to interrupt a thread, but invoke interrupt() seems not work, below is the sample code:

public class BasicThreadrRunner {
    public static void main(String[] args) {
   ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.