[#4357] Fix possible assert error in GlobalEventExecutor
Motivation: We started the thread before store it in a field which could lead to an assert error when the thread is executed before we actually store it. Modifications: Store thread before start it. Result: No more assert error possible.
This commit is contained in:
parent
bd4df20eb3
commit
b7e947709e
@ -214,8 +214,11 @@ public final class GlobalEventExecutor extends AbstractScheduledEventExecutor {
|
||||
private void startThread() {
|
||||
if (started.compareAndSet(false, true)) {
|
||||
Thread t = threadFactory.newThread(taskRunner);
|
||||
t.start();
|
||||
// Set the thread before starting it as otherwise inEventLoop() may return false and so produce
|
||||
// an assert error.
|
||||
// See https://github.com/netty/netty/issues/4357
|
||||
thread = t;
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user