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

Thread should not delete itself

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 9
    • 1.4.1
    • hotspot
    • generic
    • generic

      When a thread exits, it should not delete itself.

      There are two problems with this:

      1) Existing bugs due to continued referencing:
      If you first set the thread to null and then do the deletion,
      you run into problems with PrintHeapAllocation referencing TLS::current()
      as part of the deletion.
      If you first do the deletion and then set the thread to null, then
      if you get an interrupt between them, you will dereference already
      freed memory.

      2) violating C++ sematics
      Thanks to Lawrence Crowl and Dafe Detlefs for walking through this
      semantic descussion:

      "The this pointer has to be valid throughout the entire execution of
      every member function. For that reasons, the code is invalid."

            Unassigned Unassigned
            acorn Karen Kinnear (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: