On 7/04/2021 6:06 pm, Robbin Ehn wrote:
On Wed, 7 Apr 2021 07:04:50 GMT, Robbin Ehn <r...@openjdk.org> wrote:

I'm also unclear what Robbin is referring to. I go back to my original comment 
that surely JVMTI_ERROR_THREAD_NOT_ALIVE is impossible here?

We do a callback with a terminated thread, if the thread then in the agent 
tries to suspend itself we should return JVMTI_ERROR_THREAD_NOT_ALIVE.

"How can you do a callback on a terminated thread here? The thread should
only respond to the suspend request before it reaches the point in its
exit where it would report "not alive"."

We need to keep the threadObj while we are not terminated.
When terminated we need to clear threadObj and notify any waiters.
ObjectLocker executes OM::enter(), on contention OM::enter() do a callback to 
your agent.
If you on that callback execute suspendThreadList(), the correct return value 
for:
`"JvmtiSuspendControl::suspend(current)"` would be 
JVMTI_ERROR_THREAD_NOT_ALIVE, since JavaThread::is_exiting() would return true here.

Sorry yes I see what you mean.

Thanks,
David

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

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

Reply via email to