Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kyri-petrou
Copy link
Contributor

While reviewing #9131 I realised that we're not propagating the number of operations that were evaluated when we re-enter FiberRuntime#runLoop. This means that an infinitely running WhileLoop will never auto-yield.

Note that the implementation is not strictly correct, as the number of operations executed in "deeper" levels are not propagated backwards. The only way to make this behaviour exact is to use a heap variable or propagate a mutable counter when re-entering runLoop. However, since I don't think we need to be very strict with when we auto-yield, this more lightweight implementation should be good enough.

@jdegoes what do you think regarding the above?

@jdegoes
Copy link
Member

jdegoes commented Nov 12, 2024

However, since I don't think we need to be very strict with when we auto-yield, this more lightweight implementation should be good enough.

100% agreed! These numbers are only intended to be approximations.

@jdegoes jdegoes merged commit e904dff into zio:series/2.x Nov 12, 2024
18 checks passed
tmccombs added a commit to tmccombs/zio that referenced this pull request Nov 13, 2024
Since zio#9289 causes us to yield automatically during whileLoops
@kyri-petrou kyri-petrou deleted the ensure-auto-yielding-in-while-loop branch November 13, 2024 07:24
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.

3 participants