Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4223796

(thread) Bug 4082713 is not a duplicate of 4145910 and is not fixed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.8
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Name: vi73552 Date: 03/24/99


      Bug 4082713 concerns the problem that, contrary to the specification, you can start() a thread after invoking stop() on it.

      Bug 4082713 is incorrectly labelled as a duplicate of 4145910 but they are quite different. The only relationship between them is the incorrect usage of the stillborn and privateinof flags in start(), stop() and isAlive(). They are different symptoms of the same underlying problem.

      When stop() is invoked it should set the stillborn flag to true. When start() is invoked it should check the stillborn flag and ignore the request if stillborn is true.

      The following code demonstrates that you can start a thread that was previously stopped.

      public class testStartStoppedThread {

      public static void main(String[] args){

      Thread t = new Thread( new Runnable() {
         public void run(){
            for (;;) {
               try {
                 System.out.println("Thread running");
                 Thread.sleep(500);
               }
               catch(InterruptedException ex){}
            }
         }
       });
      System.out.println("invoking t.stop()");
      t.stop();
      System.out.println("t is alive? " + t.isAlive() );
      System.out.println("invoking t.start()");
      t.start();
      System.out.println("t is alive? " + t.isAlive() );
      }
      }
      (Review ID: 56051)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psoper Pete Soper (Inactive)
              Reporter:
              vasya Vassili Igouchkine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: