Should System.exit be controlled by a Scope Local?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Mar 2 16:19:46 UTC 2022


On 01/03/2022 18:17, Sean Mullan wrote:
>
>
> On 3/1/22 8:01 AM, Andrew Haley wrote:
>> On 3/1/22 11:45, Andrew Haley wrote:
>>> Sure, you wouldn't
>>> be able to use the default thread pool, but that's no big deal, I 
>>> would have
>>> thought.
>>
>> I'm sorry, I'll say that again. :-)
>>
>>
>> I meant to say "you wouldn't be able to use the default thread pool if
>> you wanted to use threads with some restrictions (e.g those that 
>> couldn't
>> invoke System.exit()).
>
> Can you explain in a little more detail as to what the compatibility 
> issues are with preventing threads in thread pools from calling 
> System.exit?

AFAIU, I believe the issue is that threads in the default pool are 
created early, so they don't see the scope local which overrides the 
semantics of System.exit.

Only threads created _after_ the scope local is set would see the 
overridden/restricted semantics.

Maurizio

>
> Thanks,
> Sean


More information about the core-libs-dev mailing list