8154529: some places in the invoke.c that use InvokeRequest* not protected with invokerLock
authorsgehwolf
Mon, 25 Apr 2016 15:32:35 +0200
changeset 38352 b0ac5e2b8641
parent 38340 ef34263f90ef
child 38353 f4b8e6e905fa
8154529: some places in the invoke.c that use InvokeRequest* not protected with invokerLock Reviewed-by: sspitsyn
jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c	Thu Apr 28 00:38:21 2016 -0700
+++ b/jdk/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/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h	Thu Apr 28 00:38:21 2016 -0700
+++ b/jdk/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);