On Mon, 4 Jul 2022 01:57:11 GMT, Kim Barrett <kbarr...@openjdk.org> wrote:

> Is "deadlock" accurate?

Yes.

In the context of the specification, "shutdown hook" means _application_ 
shutdown hook - as far as the specification is concerned, application shutdown 
hooks are the only kind of hooks. Right?

For example, the following will deadlock (when run with the changes in this PR):


public class TestHook {
  public static void main(String... arg) {
    Thread hook = new Thread("my-hook") {
      @Override
      public void run() {
        System.exit(1);
      }
    };
    Runtime.getRuntime().addShutdownHook(hook);
    System.exit(0);
  }
}

-------------

PR: https://git.openjdk.org/jdk/pull/9351

Reply via email to