Made sure that NioWorker.wakenUp is set to true only when its selector is really waken up

This commit is contained in:
Trustin Lee 2008-11-06 17:31:07 +00:00
parent 79fe2324c9
commit ea1a68cb83

View File

@ -386,9 +386,9 @@ class NioWorker implements Runnable {
if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) { if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
worker.writeTaskQueue.offer(channel.writeTask); worker.writeTaskQueue.offer(channel.writeTask);
} }
if (worker.wakenUp.compareAndSet(false, true)) { Selector workerSelector = worker.selector;
Selector workerSelector = worker.selector; if (workerSelector != null) {
if (workerSelector != null) { if (worker.wakenUp.compareAndSet(false, true)) {
workerSelector.wakeup(); workerSelector.wakeup();
} }
} }