harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r467402 - /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Date Tue, 24 Oct 2006 17:44:48 GMT
Author: geirm
Date: Tue Oct 24 10:44:47 2006
New Revision: 467402

URL: http://svn.apache.org/viewvc?view=rev&rev=467402
Log:
HARMONY-1720

Fix to pass classlib ThreadTest

Used H-1720_combined.patch

passed classlib test  test_stop_subtest0, and passed the included
ThreadStop1 test

ubuntu 6 - smoke, c-unit, ~kernel


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

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java?view=diff&rev=467402&r1=467401&r2=467402
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
(original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Thread.java
Tue Oct 24 10:44:47 2006
@@ -791,25 +791,29 @@
      * @com.intel.drl.spec_ref
      */
     public final void stop() {
-        stop(new ThreadDeath());
+        synchronized (lock) {
+        	if (isAlive()) {
+                stop(new ThreadDeath());
+        	}
+        }
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public final void stop(Throwable throwable) {
-        synchronized (lock) {
-            if (throwable == null) {
-                throw new NullPointerException("The argument is null!");
-            }
-            SecurityManager securityManager = System.getSecurityManager();
-            if (securityManager != null) {
-                securityManager.checkAccess(this);
-                if (currentThread() != this) {
-                    securityManager
-                        .checkPermission(RuntimePermissionCollection.STOP_THREAD_PERMISSION);
-                }
+        SecurityManager securityManager = System.getSecurityManager();
+        if (securityManager != null) {
+            securityManager.checkAccess(this);
+            if (currentThread() != this || !(throwable instanceof ThreadDeath)) {
+                securityManager.checkPermission(
+                    RuntimePermissionCollection.STOP_THREAD_PERMISSION);
             }
+        }
+        if (throwable == null) {
+            throw new NullPointerException("The argument is null!");
+        }
+        synchronized (lock) {
             int status = VMThreadManager.stop(this, throwable);
             if (status != VMThreadManager.TM_ERROR_NONE) {
                 throw new InternalError(
@@ -982,7 +986,7 @@
             System.gc();
         }
     }
-
+    
     /**
      * @com.intel.drl.spec_ref
      */



Mime
View raw message