Skip to content

Instantly share code, notes, and snippets.

@namchuai
Created October 29, 2017 01:35
Show Gist options
  • Save namchuai/8f24ebb2801edeb15aec15317c9467f2 to your computer and use it in GitHub Desktop.
Save namchuai/8f24ebb2801edeb15aec15317c9467f2 to your computer and use it in GitHub Desktop.
public class MonitorObject {
}
public class MyWaitNotify {
MonitorObject myMonitorObject = new MonitorObject();
public void doWait() {
synchronized(myMonitorObject) {
try {
myMonitor.wait();
} catch (InterruptedException e) { //… }
}
public void doNotify() {
synchronized(myMonitorObject) {
myMonitorObject.notify();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment