harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r588712 - in /harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp: common/agent/core/EventDispatcher.cpp common/agent/core/PacketDispatcher.cpp unix/agent/makefile unix/transport/makefile
Date Fri, 26 Oct 2007 17:06:43 GMT
Author: gshimansky
Date: Fri Oct 26 10:06:40 2007
New Revision: 588712

URL: http://svn.apache.org/viewvc?rev=588712&view=rev
Log:
Fixes for HARMONY-3269
[jdktools][jpda] Improve cleanup procedure in JDWP agent

Now PacketDispatcher and EventDispatcher threads should be joined when VMDeath event
is received. The m_threadObject has to be saved in a global reference to make it
possible because it is not a local variable.

Also removed unneeded and non-standard libgcc_s dependency from agent and transport libraries.


Modified:
    harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp
    harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp
    harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/agent/makefile
    harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/transport/makefile

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp?rev=588712&r1=588711&r2=588712&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp
(original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/EventDispatcher.cpp
Fri Oct 26 10:06:40 2007
@@ -86,7 +86,8 @@
 
         // release completion monitor and wait forever until VM kills this thread
         // TODO: remove this workaround to prevent from resource leak
-        m_completeMonitor->Wait(0);
+	// This is the old completion mechanism fixed in HARMONY-5019
+//        m_completeMonitor->Wait(0);
     }
     catch (const AgentException& e)
     {
@@ -117,8 +118,8 @@
 void EventDispatcher::Start(JNIEnv *jni) throw(AgentException) {
     JDWP_TRACE_ENTRY("Start(" << jni << ')');
 
-    m_threadObject = GetThreadManager().RunAgentThread(jni, StartFunction, this,
-        JVMTI_THREAD_MAX_PRIORITY, "_jdwp_EventDispatcher");
+    m_threadObject = jni->NewGlobalRef(GetThreadManager().RunAgentThread(jni, StartFunction,
this,
+        JVMTI_THREAD_MAX_PRIORITY, "_jdwp_EventDispatcher"));
 }
 
 void EventDispatcher::Reset(JNIEnv *jni) throw(AgentException) {
@@ -171,7 +172,9 @@
     } 
 
     // wait for thread finished
-//    GetThreadManager().Join(jni, m_threadObject);
+    GetThreadManager().Join(jni, m_threadObject);
+    jni->DeleteGlobalRef(m_threadObject);
+    m_threadObject = NULL;
 }
 
 void EventDispatcher::Clean(JNIEnv *jni) throw(AgentException) {
@@ -212,12 +215,11 @@
 
     // do not delete m_completeMonitor because thread is waiting on it
     // TODO: remove this workaround to prevent from resource leak
-    /*
+    // This is the old completion mechanism fixed in HARMONY-5019
     if (m_completeMonitor != 0){
         delete m_completeMonitor;
         m_completeMonitor = 0;
     }
-    */
 
     // clean counter for packet id
 

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp?rev=588712&r1=588711&r2=588712&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp
(original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp
Fri Oct 26 10:06:40 2007
@@ -63,8 +63,8 @@
 
     try
     {
-        m_threadObject = GetThreadManager().RunAgentThread(jni, StartFunction, this,
-            JVMTI_THREAD_MAX_PRIORITY, "_jdwp_PacketDispatcher");
+        m_threadObject = jni->NewGlobalRef(GetThreadManager().RunAgentThread(jni, StartFunction,
this,
+            JVMTI_THREAD_MAX_PRIORITY, "_jdwp_PacketDispatcher"));
     }
     catch (const AgentException& e)
     {
@@ -213,7 +213,8 @@
 
         // release completion monitor and wait forever until VM kills this thread
         // TODO: remove this workaround to prevent from resource leak
-        m_completionMonitor->Wait(0);
+	// This is the old completion mechanism fixed in HARMONY-5019
+//        m_completionMonitor->Wait(0);
     }
     catch (const AgentException& e)
     {
@@ -246,7 +247,9 @@
     }
 
     // wait for thread finished
-//    GetThreadManager().Join(jni, m_threadObject);
+    GetThreadManager().Join(jni, m_threadObject);
+    jni->DeleteGlobalRef(m_threadObject);
+    m_threadObject = NULL;
 }
 
 void 
@@ -258,12 +261,11 @@
 
     // do not delete m_completionMonitor because thread is waiting on it
     // TODO: remove this workaround to prevent from resource leak
-    /*
+    // This is the old completion mechanism fixed in HARMONY-5019
     if (m_completionMonitor != 0) {
         delete m_completionMonitor;
         m_completionMonitor = 0;
     }
-    */
 
     if (m_executionMonitor != 0) {
         delete m_executionMonitor;

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/agent/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/agent/makefile?rev=588712&r1=588711&r2=588712&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/agent/makefile
(original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/agent/makefile
Fri Oct 26 10:06:40 2007
@@ -28,7 +28,7 @@
 INCLUDES += -I$(CMNAGENT)commands -I$(CMNAGENT)core \
             -I$(COMMON)generic -Icore
 
-LDFLAGS += -lstdc++ -lgcc_s
+LDFLAGS += -lstdc++
 
 BUILDFILES = \
     $(CMNAGENT)commands/ArrayReference.o \

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/transport/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/transport/makefile?rev=588712&r1=588711&r2=588712&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/transport/makefile
(original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/main/native/jdwp/unix/transport/makefile
Fri Oct 26 10:06:40 2007
@@ -32,7 +32,7 @@
 INCLUDES += -I$(CMNTRANS)common -I$(CMNTRANS)dt_socket \
             -I$(COMMON)generic -Idt_socket
 
-LDFLAGS += -lstdc++ -lgcc_s
+LDFLAGS += -lstdc++
 
 BUILDFILES = \
     $(CMNTRANS)common/LastTransportError.o \



Mime
View raw message