I have been playing with my own version of this, using \'if\', and all seems to be working fine. Of course this will break down horribly if signalAll() is used instead of s
Another problem with your implementation is a potentially lost "signal". if you look closely at the jdk impls which handle InterruptedException, some of them signal before returning. this is because a thread could be chosen to be signalled and then end up getting interrupted, in which case that signal would be lost. thus, when interrupted, the jdk impls re-signal before bailing out. since this thread may or may not have actually been receiving a signal, this may also cause a "spurious wakeup" (as previously mentioned).