Add async_pending action and reactor NIF support#14
Merged
Conversation
- Add handoff/2,3 API functions for FD handoff
- Add setup_code option to run Python code in context
- Add async_pending action handling for task-based ASGI
- Add {write_ready, Fd} message handling for async completion
- Register reactor NIFs in nif_funcs table
- Fix erlang.reactor module import path in NIFs
- Add async_pending_test to py_reactor_SUITE
The reactor NIFs were using gil_acquire() which doesn't switch to the context's subinterpreter state, causing segfaults when running Python code in the wrong interpreter. Changed nif_reactor_on_read_ready, nif_reactor_on_write_ready, and nif_reactor_init_connection to use py_context_acquire/py_context_release which properly handles thread state switching for subinterpreters.
Provides a clean API for protocols to signal async completion instead of manually sending to the reactor PID. The reactor PID is stored per-fd in init_connection and cleaned up in close_connection.
Added context parameter to reactor_close_fd NIF so it can properly switch to the subinterpreter's thread state before calling Python.
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.
Summary