Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Created November 16, 2010 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaskoz/702380 to your computer and use it in GitHub Desktop.
Save vaskoz/702380 to your computer and use it in GitHub Desktop.
public class Sample
{
private static boolean done;
public static void main(String[] args) throws InterruptedException
{
new Thread(new Runnable()
{
public void run()
{
int val = 0;
while(!done) { val += 1; }
System.out.println("done!");
}
}).start();
Thread.sleep(2000);
done = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment