harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()
Date Fri, 06 Jul 2007 13:51:04 GMT
[drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

----------------------------------------------------------------------------------------------------

                 Key: HARMONY-4385
                 URL: https://issues.apache.org/jira/browse/HARMONY-4385
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Elena Sayapina
            Priority: Minor


Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume(),
If Thread.suspend() call number = Thread.resume() call number then thread is resumed.

Please, consider the following code:

public class suspendTest {

	static int iter = 0;
	static boolean flag = false;
	
	public static void main(String[] args) {
	    TestThread thread = new TestThread();
	    System.out.println("Start...");
	    try {
	         thread.start();
	         Thread.currentThread().sleep(3000);
	         thread.suspend();
	         thread.suspend();
	        Thread.currentThread().sleep(1000);
	        iter = 0;
	        flag = false;
	        thread.resume();
	        Thread.currentThread().sleep(3000);
	        thread.stop();
	        if (flag) System.out.println("TEST PASSED");
	        else System.out.println("TEST FAILED: thread wasn't resumed");
	    } catch (Exception e) {
	        System.out.println("TEST FAILED: unexpected " + e);
	    }
	}
}

class TestThread extends Thread {
	
    public void run () {
    	while(suspendTest.iter < Integer.MAX_VALUE) {
    	    suspendTest.flag = true;
    	    try {
    	        Thread.currentThread().sleep(300);
	    } catch (InterruptedException e) {}
                         suspendTest.iter++;
                     }
    	System.out.println("WARNING: out of cycle");
    }
}

Output on Harmony-r553727:
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r553727, (Jul  6 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

Start...
TEST FAILED: thread wasn't resumed

Output on RI:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

Start...
TEST PASSED


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message