From b055ba967b68bead5223f241413d88a27e86d15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Endre=20S=C3=A1ndor=20Varga?= Date: Tue, 7 May 2013 18:38:54 +0200 Subject: [PATCH] Fixed race causing missed wakeups --- akka-actor/src/main/scala/akka/io/SelectionHandler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/akka-actor/src/main/scala/akka/io/SelectionHandler.scala b/akka-actor/src/main/scala/akka/io/SelectionHandler.scala index c608324f70..dc54e2aea3 100644 --- a/akka-actor/src/main/scala/akka/io/SelectionHandler.scala +++ b/akka-actor/src/main/scala/akka/io/SelectionHandler.scala @@ -164,7 +164,6 @@ private[io] class SelectionHandler(settings: SelectionHandlerSettings) extends A val select = new Task { def tryRun(): Unit = { - wakeUp.set(false) // Reset early, worst-case we do a double-wakeup, but it's supposed to be idempotent so it's just an extra syscall if (selector.select() > 0) { // This assumes select return value == selectedKeys.size val keys = selector.selectedKeys val iterator = keys.iterator() @@ -194,6 +193,7 @@ private[io] class SelectionHandler(settings: SelectionHandlerSettings) extends A keys.clear() // we need to remove the selected keys from the set, otherwise they remain selected } + wakeUp.set(false) // worst-case we do a double-wakeup, but it's supposed to be idempotent so it's just an extra syscall // FIXME what is the appropriate error-handling here, shouldn't this task be resubmitted in case of exception? selectorManagementEC.execute(this) // re-schedules select behind all currently queued tasks }