GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid unsynchronized access to scheduledTaskQueue in GlobalEventExecu… · netty/netty@b4dcd18

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common/src/main/java/io/netty/util/concurrent
    • GlobalEventExecutor.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java‎

Copy file name to clipboardExpand all lines: common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,9 @@ public void run() {
263263
boolean stopped = started.compareAndSet(true, false);
264264
assert stopped;
265265

266-
// Check if there are pending entries added by execute() or schedule*() while we do CAS above.
267-
if (taskQueue.isEmpty() && scheduledTaskQueue.size() <= 1) {
266+
// Do not check scheduledTaskQueue because it is not thread-safe and can only be mutated from a
267+
// TaskRunner actively running tasks.
268+
if (taskQueue.isEmpty()) {
268269
// A) No new task was added and thus there's nothing to handle
269270
// -> safe to terminate because there's nothing left to do
270271
// B) A new thread started and handled all the new tasks.

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.