You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/07/06 15:51:04 UTC

[jira] Created: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

[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.


[jira] Commented: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

Posted by "Elena Sayapina (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511120 ] 

Elena Sayapina commented on HARMONY-4385:
-----------------------------------------

Yes, Weldon, 
If the number of suspend() calls is equal to the number of resume() calls then the test passes.

> [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.


[jira] Commented: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

Posted by "weldon washburn (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510783 ] 

weldon washburn commented on HARMONY-4385:
------------------------------------------

do you know if two consecutive resume(0's will make the thread restart?  Can someone try this please?

> [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.


[jira] Closed: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gregory Shimansky closed HARMONY-4385.
--------------------------------------

    Resolution: Fixed
      Assignee: Gregory Shimansky  (was: weldon washburn)

Ok closing this bug since resume is not recursive any more.

> [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
>            Assignee: Gregory Shimansky
>            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.


[jira] Assigned: (HARMONY-4385) [drlvm][thread] Thread isn't resumed if call Thread.suspend() more than ones before Thread.resume()

Posted by "weldon washburn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

weldon washburn reassigned HARMONY-4385:
----------------------------------------

    Assignee: weldon washburn

> [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
>            Assignee: weldon washburn
>            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.