On Fri, 10 Jun 2022 11:31:06 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:

>> https://github.com/openjdk/jdk/blob/bc28baeba9360991e9b7575e1fbe178d873ccfc1/src/java.base/share/classes/jdk/internal/misc/Signal.java#L177-L178
>> 
>> Instead of separate Hashtable.get/remove calls we can just use value 
>> returned by `remove`,
>> It results in cleaner and a bit faster code.
>
> Andrey Turbanov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8288140: Avoid redundant Hashtable.get call in Signal.handle
>   apply dmlloyd's suggestion

Marked as reviewed by rriggs (Reviewer).

src/java.base/share/classes/jdk/internal/misc/Signal.java line 181:

> 179:         } else {
> 180:             oldHandler = handlers.remove(sig);
> 181:         }

A ternary assignment might be an alternative here:

 Signal.Handler oldHandler = (newH == 2) ? handlers.put(sig, handler) : 
handlers.remove(sig);

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

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

Reply via email to