RFR: 8288984: Simplification in java.lang.Runtime::exit [v2]

Chris Hegarty chegar at openjdk.org
Wed Jul 6 10:51:34 UTC 2022


On Mon, 4 Jul 2022 12:19:27 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Ryan Ernst has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   better clarify multiple threads behavior
>
>> Let's say we've run shutdown so run all the hooks but not halted. Then someone calls exit(0). That seems to suggest the call will block indefinitely, which is neither desirable nor what was actually implemented.
> 
> If the hook threads do not halt then the exiting thread (which holds the lock) blocks forever in the join(). Any other call to exit blocks trying to acquire the lock. That has always been the way this works - if hook threads don't terminate then the VM doesn't (unless someone calls halt() directly). That is one of the things the window you suggested be closed, allowed - a call to exit(non-zero) could force a call to halt().

@dholmes-ora @AlanBateman @kimbarrett The following [CSR](https://bugs.openjdk.org/browse/JDK-8289824) has been filed to cover the specification related changes in this PR - please review as appropriate.

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

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


More information about the core-libs-dev mailing list