Skip to content

Commit

Permalink
8307156: native_thread not protected by TLH
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, dcubed
  • Loading branch information
Markus Grönlund committed May 4, 2023
1 parent 5ca0b08 commit 0c6529d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hotspot/share/jfr/jni/jfrJavaSupport.cpp
Expand Up @@ -664,8 +664,7 @@ bool JfrJavaSupport::is_jdk_jfr_module_available(outputStream* stream, TRAPS) {

typedef JfrOopTraceId<ThreadIdAccess> AccessThreadTraceId;

static JavaThread* get_native(jobject thread) {
ThreadsListHandle tlh;
static JavaThread* get_native(ThreadsListHandle& tlh, jobject thread) {
JavaThread* native_thread = NULL;
(void)tlh.cv_internal_thread_to_JavaThread(thread, &native_thread, NULL);
return native_thread;
Expand Down Expand Up @@ -704,7 +703,8 @@ void JfrJavaSupport::exclude(JavaThread* jt, oop ref, jobject thread) {
return;
}
}
jt = get_native(thread);
ThreadsListHandle tlh;
jt = get_native(tlh, thread);
if (jt != nullptr) {
JfrThreadLocal::exclude_jvm_thread(jt);
}
Expand All @@ -720,7 +720,8 @@ void JfrJavaSupport::include(JavaThread* jt, oop ref, jobject thread) {
return;
}
}
jt = get_native(thread);
ThreadsListHandle tlh;
jt = get_native(tlh, thread);
if (jt != nullptr) {
JfrThreadLocal::include_jvm_thread(jt);
}
Expand Down

1 comment on commit 0c6529d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.