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

Rework thread initialization and teardown logic

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 12
    • hotspot
    • b02

      A few cleanups to make init and tear-down clearer for both NonJavaThreads and JavaThreads. In particular:

      - Move NJT-list management to init/tear-down of the active thread, instead of constructor/destructor
      - Factor out common code across different kinds of NJTs
      - Make it easier to add init/teardown code across thread types

      Proposed approach in non-virtual call_run:

      void call_run() {
        // common init for all threads
        ...
        // virtual init
        this->pre_run();

        this_run();

        // common teardown

        // virtual teardown
        this->post_run()
        
        // Note: can't reference 'this' here as post_run may have deleted it
        ...
      }

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: