Created
October 29, 2017 01:35
-
-
Save namchuai/8f24ebb2801edeb15aec15317c9467f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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