415062 SelectorManager wakeup optimisation

Some further cleanup after sbordet review
This commit is contained in:
Greg Wilkins 2013-08-16 23:12:24 +10:00
parent 70e7a69d19
commit b58c05d77c
1 changed files with 2 additions and 3 deletions

View File

@ -366,12 +366,11 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
if (_thread==Thread.currentThread())
{
// If we are already iterating over the changes, just add this change to the list.
// No race here because it is this thread that is iterating over the changes.
if (_state.compareAndSet(SelectorState.CHANGING,SelectorState.MORE_CHANGES))
if (_state.get()==SelectorState.CHANGING)
_changes.offer(change);
else
{
// Otherwise we run the queued changes
// Otherwise we run the queued changes, list should mostly be empty
runChanges();
// and then directly run the passed change
runChange(change);