On Fri, 29 Oct 2021 22:35:50 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:
>> The `is_exiting` check seems unnecessary as the handshake code will not >> handshake with an exiting thread. The nested TLH was unnecessary too AFAICS. > > Ummmm... The purpose of the new `is_exiting()` check and the baseline's > `ThreadsListHandle::includes()` check is to avoid making this call: > > return this->handshake_state()->suspend(); > > The call we are avoiding is the one that makes the synchronous > SuspendThreadHandshake request (for threads other than self) > so by detecting the exiting thread early, we are avoiding entering > the handshake machinery. But why do we care about that? The low-level mechanism handles exiting threads so there is no need for the higher-level code to do that. The current logic gives the appearance that we must filter out exiting threads at this level because the lower-level code does not handle them. ------------- PR: https://git.openjdk.java.net/jdk/pull/4677