hi, Trustin, a little optimize suggestion on selector.wakeup

codeall codeallcn at gmail.com
Thu Jan 6 00:38:06 EST 2011


Like what you said in NETTY-114

Fixed by making sure wakeup() is called when necessary. Excessive wakeups
are suppressed for better performance, but there's a small possibility of
duplicate (i.e. unnecessary) wakeups due to this fix. I expect the extra
cost of duplicate wakeups are very small. 

what about change NioWorker from

wakenUp.set(false);
...
SelectorUtil.select(selector);
if (wakenUp.get()) {
    selector.wakeup();
}

to

wakenUp.set(false);
...
SelectorUtil.select(selector);
wakenUp.set(false);


Will the race condition gone and save some wake up calls?
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/hi-Trustin-a-little-optimize-suggestion-on-selector-wakeup-tp5894637p5894637.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.


More information about the netty-dev mailing list