summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'openjdkjvmti/ti_object.cc')
-rw-r--r--openjdkjvmti/ti_object.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/openjdkjvmti/ti_object.cc b/openjdkjvmti/ti_object.cc
index f37df86048..24ccbaf417 100644
--- a/openjdkjvmti/ti_object.cc
+++ b/openjdkjvmti/ti_object.cc
@@ -105,13 +105,15 @@ jvmtiError ObjectUtil::GetObjectMonitorUsage(
notify_wait.push_back(jni->AddLocalReference<jthread>(thd->GetPeerFromOtherThread()));
wait.push_back(jni->AddLocalReference<jthread>(thd->GetPeerFromOtherThread()));
}
+ // Scan all threads to see which are waiting on this particular monitor.
+ std::list<art::Thread*> thread_list;
{
- // Scan all threads to see which are waiting on this particular monitor.
art::MutexLock tll(self, *art::Locks::thread_list_lock_);
- for (art::Thread* thd : art::Runtime::Current()->GetThreadList()->GetList()) {
- if (thd != info.owner_ && target.Ptr() == thd->GetMonitorEnterObject()) {
- wait.push_back(jni->AddLocalReference<jthread>(thd->GetPeerFromOtherThread()));
- }
+ thread_list = art::Runtime::Current()->GetThreadList()->GetList();
+ }
+ for (art::Thread* thd : thread_list) {
+ if (thd != info.owner_ && target.Ptr() == thd->GetMonitorEnterObject()) {
+ wait.push_back(jni->AddLocalReference<jthread>(thd->GetPeerFromOtherThread()));
}
}
}