changeset 14472:c43aba5fc69b

8154529: some places in the invoke.c that use InvokeRequest* not protected with invokerLock Reviewed-by: sspitsyn
author sgehwolf
date Mon, 25 Apr 2016 15:32:35 +0200
parents ce87b09f35dd
children 08a5c72f79e3
files src/jdk.jdwp.agent/share/native/libjdwp/invoker.c src/jdk.jdwp.agent/share/native/libjdwp/invoker.h
diffstat 2 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c	Thu Apr 28 00:38:21 2016 -0700
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c	Mon Apr 25 15:32:35 2016 +0200
@@ -277,12 +277,14 @@
 
     JDI_ASSERT(thread);
 
+    debugMonitorEnter(invokerLock);
     request = threadControl_getInvokeRequest(thread);
     if (request == NULL) {
         EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
     }
 
     request->available = JNI_TRUE;
+    debugMonitorExit(invokerLock);
 }
 
 jvmtiError
@@ -739,29 +741,20 @@
 }
 
 jboolean
-invoker_isPending(jthread thread)
+invoker_isEnabled(jthread thread)
 {
     InvokeRequest *request;
+    jboolean isEnabled;
 
     JDI_ASSERT(thread);
+    debugMonitorEnter(invokerLock);
     request = threadControl_getInvokeRequest(thread);
     if (request == NULL) {
         EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
     }
-    return request->pending;
-}
-
-jboolean
-invoker_isEnabled(jthread thread)
-{
-    InvokeRequest *request;
-
-    JDI_ASSERT(thread);
-    request = threadControl_getInvokeRequest(thread);
-    if (request == NULL) {
-        EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
-    }
-    return request->available;
+    isEnabled = request->available;
+    debugMonitorExit(invokerLock);
+    return isEnabled;
 }
 
 void
--- a/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h	Thu Apr 28 00:38:21 2016 -0700
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h	Mon Apr 25 15:32:35 2016 +0200
@@ -67,7 +67,6 @@
 jboolean invoker_doInvoke(jthread thread);
 
 void invoker_completeInvokeRequest(jthread thread);
-jboolean invoker_isPending(jthread thread);
 jboolean invoker_isEnabled(jthread thread);
 void invoker_detach(InvokeRequest *request);