/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This source file is part of SableVM. * * * * See the file "LICENSE" for the copyright information and for * * the terms and conditions for copying, distribution and * * modification of this source file. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ public class Suspend implements Runnable { private static Object monitor = new Object(); public static volatile boolean done = false; public static void main(String[] args) throws Throwable { Thread t = new Thread(new Suspend()); t.start(); System.out.println("launched"); synchronized(monitor) { monitor.wait(); } t.suspend(); System.out.println("suspended"); t.resume(); System.out.println("resumed"); done = true; } public void run() { synchronized(monitor) { monitor.notify(); System.out.println("hi!"); } while(!done); } }