On Fri, 5 Nov 2021 15:38:27 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:

>> Should the ThreadsListHandle protect JvmtiThreadState::first also?  If 
>> state->next() needs it why doesn't the first entry need this?  There's no 
>> atomic load on the _head field.
>
> The `ThreadsListHandle` protects `JavaThread` objects not `JvmtiThreadState` 
> objects.
> `JvmtiThreadState::first()` returns the head of the global list of 
> `JvmtiThreadState`
> objects for the system. Each `JvmtiThreadState` object contains a 
> `JavaThread*` and
> we have to protect use of the `JavaThread*` which can happen in the
> `recompute_thread_enabled(state)` call below.

JvmtiThreadState objects point to JavaThread and vice versa, so I still don't 
see why you don't protect the first element.

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

PR: https://git.openjdk.java.net/jdk/pull/4677

Reply via email to