Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PollResult, PollingSystem#processReadyEvents #4230

Merged
merged 4 commits into from
Jan 9, 2025

Conversation

armanbilge
Copy link
Member

Fixes #4229.

PollingSystem#poll is now split into poll and processReadyEvents, where poll does the blocking syscall (and nothing more) and processReadyEvents handles rescheduling of fibers on the runtime. This enables the WorkerThread to unpark after poll and before processReadyEvents, so that it is in the appropriate state for receiving new work on its local queue.

@@ -480,6 +481,9 @@ private[effect] final class WorkerThread[P <: AnyRef](
if (parked.getAndSet(false)) {
pool.doneSleeping()
}
if (polled) { // TODO, if no tasks scheduled and no timers could fastpath back to park?
val _ = system.processReadyEvents(_poller)
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as below.

@djspiewak
Copy link
Member

Btw this is a much better name than what I came up with

@armanbilge armanbilge changed the title Introduce PollingSystem#processReadyEvents Introduce PollResult, PollingSystem#processReadyEvents` Jan 8, 2025
@armanbilge armanbilge changed the title Introduce PollResult, PollingSystem#processReadyEvents` Introduce PollResult, PollingSystem#processReadyEvents Jan 8, 2025
@armanbilge armanbilge added this to the v3.6.0 milestone Jan 9, 2025
@djspiewak djspiewak merged commit 6b1a0bd into typelevel:series/3.6.x Jan 9, 2025
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workers shouldn't schedule local tasks while parked
2 participants