Fixed race causing missed wakeups
This commit is contained in:
parent
3bc661bed6
commit
b055ba967b
1 changed files with 1 additions and 1 deletions
|
|
@ -164,7 +164,6 @@ private[io] class SelectionHandler(settings: SelectionHandlerSettings) extends A
|
||||||
|
|
||||||
val select = new Task {
|
val select = new Task {
|
||||||
def tryRun(): Unit = {
|
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
|
if (selector.select() > 0) { // This assumes select return value == selectedKeys.size
|
||||||
val keys = selector.selectedKeys
|
val keys = selector.selectedKeys
|
||||||
val iterator = keys.iterator()
|
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
|
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?
|
// 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
|
selectorManagementEC.execute(this) // re-schedules select behind all currently queued tasks
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue