Correct logic in Switch.whileOff, see #2569

This commit is contained in:
Patrik Nordwall 2012-09-27 08:33:54 +02:00
parent d9eaace907
commit 85a4743a47

View file

@ -115,7 +115,7 @@ class Switch(startAsOn: Boolean = false) {
* Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
*/
def whileOff(action: Unit): Boolean = synchronized {
if (switch.get) {
if (!switch.get) {
action
true
} else false