Make use of MPSC queue to reduce overhead

This commit is contained in:
Norman Maurer 2020-08-25 19:04:30 +02:00
parent 9576c939d8
commit 3229d7e553

View File

@ -73,6 +73,17 @@ final class IOUringEventLoop extends SingleThreadEventLoop {
logger.trace("New EventLoop: {}", this.toString());
}
@Override
protected Queue<Runnable> newTaskQueue(int maxPendingTasks) {
return newTaskQueue0(maxPendingTasks);
}
private static Queue<Runnable> newTaskQueue0(int maxPendingTasks) {
// This event loop never calls takeTask()
return maxPendingTasks == Integer.MAX_VALUE ? PlatformDependent.<Runnable>newMpscQueue()
: PlatformDependent.<Runnable>newMpscQueue(maxPendingTasks);
}
public long incrementEventIdCounter() {
long eventId = eventIdCounter;
logger.trace("incrementEventIdCounter EventId: {}", eventId);