Problem with Synchronization
<p>I have the following sample piece of code,</p>

<pre><code>public class test implements Runnable{

  public void run()
  {
    synchronized(this)
    {
        for(int i=0;i&lt;10000;i++)
            System.out.println(i);
    }
  }
  public static void main(String args[]) throws Exception
  {
    Thread t=new Thread(new test());
    t.start();

    //Thread.sleep(100);
    t.suspend();
    System.out.println("Hi");
  }
}
</code></pre>

<p>I have the following requirement,When the thread is suspended it must execute all the iterations of the loop without getting suspended. I felt that synchronized is for this purpose but it didnot solve the problem. When i suspend a thread if it is in a synchronized block then it must get suspended only after the block is executed. What java construct can be used for this?</p>
