You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e44a0aa
Browse filesBrowse the repository at this point in the historyBrowse files
Collapse the dispatch paths and split the large modules (#82)
One dispatcher for every context request in C, one NIF table entry
list per area, one process body module per mode on the Erlang side,
and a py facade that delegates streaming, venvs and shared dicts to
their own modules. The thread functions and flags are named for
what they are rather than for the worker mode they came from. No
public API changes.
Copy file name to clipboardExpand all lines: c_src/README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ where things are.
14
14
| File | What it owns | Notes |
15
15
|---|---|---|
16
16
|`py_nif.h`| All shared types: `py_context_t` and its request queue, request types, callback and suspension state, runtime state machine, atoms, globals, declarations | 2.4k lines. The struct comments carry the locking rules; read `py_context_t` before touching threads |
17
-
|`py_nif.c`| Runtime init and finalize, resource types, context create/destroy, the request queue, `worker_context_thread_main` and `owngil_context_thread_main`, `owngil_execute_*` (used by both thread kinds), the `nif_context_*` NIFs, process-local envs, `py_ref`, the NIF function table at the end | Sections are banner-separated; `grep -n '^ \* ===\|^/\* ==='` lists them |
17
+
|`py_nif.c`| Runtime init and finalize, resource types, context create/destroy, the request queue, `ctx_thread_main_worker` and `ctx_thread_main_owngil`, `ctx_execute_*` (one set for both thread kinds), `ctx_dispatch` / `ctx_dispatch_async` (the only way a NIF reaches a context thread), the `nif_context_*` NIFs, process-local envs, `py_ref`, the NIF function table at the end, assembled from the `PY_*_NIFS` macros of the other files| Sections are banner-separated; `grep -n '^ \* ===\|^/\* ==='` lists them |
18
18
|`py_convert.c`|`py_to_term`, `term_to_py`, depth limits, tagged tuples (`{bytes, B}`, `{'$py_shm', ...}`), error tuples `{error, {Type, Msg}}`| The type mapping tables in the comments are the reference for `_etf.py`|
19
19
|`py_exec.c`| Execution mode detection (free-threaded or GIL build) ||
20
20
|`py_callback.c`| The `erlang` Python module: `call`, `send`, `whereis`, `schedule*`, `Atom`/`Pid`/`Ref` types, callback delivery paths (suspension, blocking pipe, async pipe), channel and shared-dict methods, callback name registry |`erlang_call_impl` documents the path precedence |
@@ -29,8 +29,8 @@ where things are.
29
29
## Where the live paths are
30
30
31
31
-`py:call/3` in worker or owngil mode: `nif_context_call_async` (`py_nif.c`)
32
-
enqueues; `worker_context_thread_main` or `owngil_context_thread_main`
33
-
dequeues and calls `owngil_execute_request`; the reply goes out as
32
+
enqueues; `ctx_thread_main_worker` or `ctx_thread_main_owngil`
33
+
dequeues and calls `ctx_execute_request`; the reply goes out as
34
34
`{py_result, Ref, Result}`.
35
35
-`erlang.call` from Python: `erlang_call_impl` (`py_callback.c`).
36
36
- Interrupt: `nif_context_interrupt` (`py_nif.c`), `interrupt_mutex` rules on
0 commit comments