add task before starting thread in SingleThreadEventExecutor.execute (#7841)
Motivation: Minor performance optimisation that prevents thread from blocking due to task not having been added to queue. Discussed #7815. Modification: add task to the queue before starting the thread. Result: No additional tests.
This commit is contained in:
parent
0a61f055f5
commit
0f4001d598
@ -762,11 +762,9 @@ public abstract class SingleThreadEventExecutor extends AbstractScheduledEventEx
|
||||
}
|
||||
|
||||
boolean inEventLoop = inEventLoop();
|
||||
if (inEventLoop) {
|
||||
addTask(task);
|
||||
} else {
|
||||
addTask(task);
|
||||
if (!inEventLoop) {
|
||||
startThread();
|
||||
addTask(task);
|
||||
if (isShutdown() && removeTask(task)) {
|
||||
reject();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user