Skip to content

Introduce PollResult, PollingSystem#processReadyEvents#4230

Merged
djspiewak merged 4 commits into
typelevel:series/3.6.xfrom
armanbilge:issue/4229
Jan 9, 2025
Merged

Introduce PollResult, PollingSystem#processReadyEvents#4230
djspiewak merged 4 commits into
typelevel:series/3.6.xfrom
armanbilge:issue/4229

Conversation

@armanbilge

Copy link
Copy Markdown
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.

Comment thread core/jvm-native/src/main/scala/cats/effect/unsafe/PollingSystem.scala Outdated
Comment thread core/jvm/src/main/scala/cats/effect/unsafe/WorkerThread.scala Outdated
pool.doneSleeping()
}
if (polled) { // TODO, if no tasks scheduled and no timers could fastpath back to park?
val _ = system.processReadyEvents(_poller)

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.

Same comment as below.

Comment thread core/native/src/main/scala/cats/effect/unsafe/KqueueSystem.scala Outdated
Comment thread core/native/src/main/scala/cats/effect/unsafe/KqueueSystem.scala
@djspiewak

Copy link
Copy Markdown
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
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