Rework fibres runtime for coroutine-safe errors, scopes, and channel/waitgroup semantics - #56
Merged
Merged
Conversation
…dead scopes from spawning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Reworks the fibres runtime to be exception-neutral, coroutine-safe, and aligned with structured concurrency semantics.
Introduces a local
coxpcallshim providing coroutine-safepcall/xpcallandcoroutine.runningsemantics.Changes
fibers.runtimeto route uncaught fiber errors through an internal queue andwait_fiber_error, rather than aborting the process.Refactors
fibers.scopeto:scope.runreturn(status, error, ...)instead of raising,Scope:spawnonly runs on a running scope,Simplifies
fibers.op:wrap_handlerand exception-based control flow,or_else,finally,bracketand higher-level choice helpers (race,first_ready,named_choice,boolean_choice),new_condand nack signalling to run via the scheduler andcoxpcall.Reworks
fibers.channelto:on_abort,Reimplements
fibers.waitgroupwith per-generation conditions so waitgroups can be reused safely.Tightens
fibers.performer.performwith an explicitEventmetatable check.Extends syscall errno exports with
EBADFandENOENT.Updates tests (
test_channel,test_cond,test_op,test_scope,test_waitgroup) to reflect the new semantics and add coverage for waitgroup reuse and scope cancellation paths.Manual test
Manual test description
Ran the Lua test suite locally. All completed without failures.
Added tests?
Added to documentation?