py_event_worker (erlang_python v5.0.0)

View Source

Event worker for Erlang-native asyncio event loop.

This gen_server implements the scalable I/O model with one worker per Python context. Each worker: - Receives {select, FdRes, Ref, ready_input|ready_output} directly from enif_select - Handles {timeout, TimerRef} messages for timer dispatch - Manages timers via erlang:send_after to self()

Owns: the readiness and timer messages of one loop, and its task_ready coalescing. Talks to: the py_event_loop.c NIFs (process_ready_tasks, timers), py_event_worker_registry. Never: runs the loop itself in owngil mode (the context thread does) and never blocks on Python.

Summary

Functions

code_change(OldVsn, State, Extra)

get_loop_ref(Pid)

get_worker_id(Pid)

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

init(_)

start_link(WorkerId, LoopRef)

start_link(WorkerId, LoopRef, Opts)

stop(Pid)

terminate(Reason, State)