I read there may occure spurious wake ups in which thread waiting can wake up without notify and notifyAll calls, how can we prevent such wake ups? Do spurious wakeups actually happen?
Asked
Active
Viewed 68 times
0
-
3Possible duplicate of [Do spurious wakeups actually happen?](http://stackoverflow.com/questions/1050592/do-spurious-wakeups-actually-happen) – AlBlue Jun 12 '16 at 15:24
-
You can _not_ prevent them. That's _one_ reason why, when ever a `wait()` call returns, your code must check to see whether the event it's waiting for has happened or not. – Solomon Slow Jun 12 '16 at 17:41
-
https://docs.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html – Solomon Slow Jun 12 '16 at 17:48