Skip to content

Remove one-line wrappers from Queue's fiber scheduler code - #10045

Merged
headius merged 2 commits into
jruby:masterfrom
sampokuokkanen:trim-queue-scheduler-waiters
Nov 13, 2026
Merged

headius merged 2 commits into
jruby:masterfrom
sampokuokkanen:trim-queue-scheduler-waiters

Conversation

@sampokuokkanen

Copy link
Copy Markdown
Contributor

Follow-up to the review of #9805, where the Queue scheduler code was noted as repetitive. This is a small local cleanup, not the shared "scheduler is active" abstraction across classes discussed there. Behavior does not change.

  • Remove five one-line wrappers (unblockSchedulerTaker and others) and call the helpers directly.
  • Queue reuses Mutex's SchedulerWaiters type instead of declaring its own copy.
  • schedulerBlock takes a push/pop flag and checks readiness in one method, instead of taking a list and a lambda from each caller.
  • The waiter fields and helpers are now package-private. Only Queue and SizedQueue use them.

The removed protected members (Queue.SchedulerWaiters, unblockSchedulerTaker and others) were added in 10.1.3 for this code only, so I removed them without a deprecation step.

Call the waiter helpers on the two lists directly instead of through
one-line wrappers, and reuse Mutex's SchedulerWaiters type. In
schedulerBlock, a push flag picks the list and the ready check, so
callers no longer pass a list and a lambda.

@headius headius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I feel good about this.

@headius
headius merged commit 9ffb8db into jruby:master Nov 13, 2026
146 checks passed
@sampokuokkanen
sampokuokkanen deleted the trim-queue-scheduler-waiters branch November 15, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants