summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Thread.cc
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2018-05-25 16:10:02 +0100
committerPaul Duffin <paulduffin@google.com>2018-05-25 16:10:02 +0100
commita4f1f6e7ea1066a0ee3a2d99eb0b2bd90474bf04 (patch)
tree0125fa45d7ddad139eef5f8ed53f0bfc2fec118c /runtime/native/java_lang_Thread.cc
parent8a9fccc34fc05041c754f025ad5a1109b84adddb (diff)
Rename nativeHoldsLock to holdsLock and make it work on current thread
The Java native method nativeHoldsLock has been renamed to match the upstream OpenJDK 8u121-b13 and changed from an instance method on Thread to a static method. This makes the corresponding change to the native implementation of that method. Test: make checkbuild, flash, CtsLibcoreTestCases Bug: 74379469 Change-Id: Ib9dedccd3014c01c148ff824764be319c2a7a123
Diffstat (limited to 'runtime/native/java_lang_Thread.cc')
-rw-r--r--runtime/native/java_lang_Thread.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 9edb0c21dd..a37a76f809 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -111,15 +111,14 @@ static jint Thread_nativeGetStatus(JNIEnv* env, jobject java_thread, jboolean ha
return -1; // Unreachable.
}
-static jboolean Thread_nativeHoldsLock(JNIEnv* env, jobject java_thread, jobject java_object) {
+static jboolean Thread_holdsLock(JNIEnv* env, jclass, jobject java_object) {
ScopedObjectAccess soa(env);
ObjPtr<mirror::Object> object = soa.Decode<mirror::Object>(java_object);
if (object == nullptr) {
ThrowNullPointerException("object == null");
return JNI_FALSE;
}
- MutexLock mu(soa.Self(), *Locks::thread_list_lock_);
- Thread* thread = Thread::FromManagedThread(soa, java_thread);
+ Thread* thread = soa.Self();
return thread->HoldsLock(object.Ptr());
}
@@ -200,7 +199,7 @@ static JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Thread, isInterrupted, "()Z"),
NATIVE_METHOD(Thread, nativeCreate, "(Ljava/lang/Thread;JZ)V"),
NATIVE_METHOD(Thread, nativeGetStatus, "(Z)I"),
- NATIVE_METHOD(Thread, nativeHoldsLock, "(Ljava/lang/Object;)Z"),
+ NATIVE_METHOD(Thread, holdsLock, "(Ljava/lang/Object;)Z"),
FAST_NATIVE_METHOD(Thread, nativeInterrupt, "()V"),
NATIVE_METHOD(Thread, nativeSetName, "(Ljava/lang/String;)V"),
NATIVE_METHOD(Thread, nativeSetPriority, "(I)V"),