Skip to content

Instantly share code, notes, and snippets.

@pdeva
Last active August 29, 2015 14:01
Show Gist options
  • Save pdeva/0c98a29d92ed38e0d20c to your computer and use it in GitHub Desktop.
Save pdeva/0c98a29d92ed38e0d20c to your computer and use it in GitHub Desktop.
class Foo
{
private boolean stop;
//called by thread 1
public void run()
{
while(!stop)
{
//do something
}
}
//called by thread 2
public void doStop()
{
stop=true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment