Skip to content

Commit 9150564

Browse files
authored
Add handle-based Python C API for per-loop isolation (#5)
Add isolated event loops with `ErlangEventLoop(isolated=True)` Each isolated loop has its own pending queue for full callback isolation. Full asyncio support (timers, FD operations) via shared router. Useful for multi-threaded Python, sub-interpreters, and free-threaded Python (3.13+). Implementation: - Add `isolated=False` parameter to `ErlangEventLoop.__init__` - Add handle-based Python C API (`_loop_new`, `_run_once_native_for`, etc.) - Add shared router for per-loop created loops (`set_shared_router` NIF) - Timer messages include LoopRef for correct dispatch to isolated loops - Router stores LoopRef with each timer, dispatches to correct loop See `docs/asyncio.md` for usage and architecture details.
1 parent 7326786 commit 9150564

11 files changed

Lines changed: 1784 additions & 32 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
### Added
2020

21+
- **Isolated Event Loops** - Create isolated event loops with `ErlangEventLoop(isolated=True)`
22+
- Each isolated loop has its own pending queue
23+
- Full asyncio support (timers, FD operations) via shared router
24+
- Useful for multi-threaded Python applications
25+
- See `docs/asyncio.md` for usage and architecture details
26+
2127
- **Python Logging Integration** - Forward Python's `logging` module to Erlang's `logger`
2228
- `py:configure_logging/0,1` - Setup Python logging to forward to Erlang
2329
- `erlang.ErlangHandler` - Python logging handler that sends to Erlang

0 commit comments

Comments
 (0)