harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r549879 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang: Thread.java VMThreadManager.java
Date Fri, 22 Jun 2007 17:02:18 GMT
Author: wjwashburn
Date: Fri Jun 22 10:02:17 2007
New Revision: 549879

URL: http://svn.apache.org/viewvc?view=rev&rev=549879
Log:
harmony-4158:  this patch eliminates unexpected InternalError exception when 
Thread.suspend() is called


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?view=diff&rev=549879&r1=549878&r2=549879
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Fri Jun 22 10:02:17 2007
@@ -865,12 +865,23 @@
      * @deprecated
      */
     public final void suspend() {
-            checkAccess();
-            int status = VMThreadManager.suspend(this);
-            if (status != VMThreadManager.TM_ERROR_NONE) {
-                throw new InternalError(
-                    "Thread Manager internal error " + status);
-            }
+	int status;
+	
+	checkAccess();
+	
+	// We can receive EBUSY from VMThreadManager.suspend() if we are 
+	// requested to suspend ourselves. If we are requested to suspend we
+	// cannot to suspend other threads, so we need to try to suspend
+	// again.
+	
+	do {
+	    status = VMThreadManager.suspend(this);
+	} while (status == VMThreadManager.TM_ERROR_EBUSY);
+	
+	if (status != VMThreadManager.TM_ERROR_NONE) {
+	    throw new InternalError(
+				    "Thread Manager internal error " + status);
+	}
     }
 
     /**

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java?view=diff&rev=549879&r1=549878&r2=549879
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/VMThreadManager.java
Fri Jun 22 10:02:17 2007
@@ -43,7 +43,7 @@
     public static final int TM_ERROR_NONE = 0;
     public static final int TM_ERROR_INTERRUPT = 52;
     public static final int TM_ERROR_ILLEGAL_STATE = 51;
-
+    public static final int TM_ERROR_EBUSY = 70025;
 
     /**
      * JVMTI constants



Mime
View raw message