Document lock and ownership contracts - #76
Merged
Merged
Conversation
The py_context_t header still described dirty-scheduler execution over a shared-GIL pool. It now says which thread owns each field group, what each mutex guards, the lock order, and why a stuck context is leaked rather than freed. The event loop struct gets the same treatment, and the Erlang modules that own a resource state in three lines what they own, who they talk to and what they never do.
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.
The struct comments are where a reader decides whether a change is safe, and the one on
py_context_tdescribed a design that no longer exists. This rewrites it as the contract the code follows today: one context thread runs Python, NIFs only enqueue,queue_mutexbeforereq->mutex,interrupt_mutexnever with a GIL held, the request mirror andmsg_envtouched by the context thread only, and the join-or-leak rule on shutdown.erlang_event_loop_tgets the same for its four mutexes and the interpreter detach handshake. On the Erlang sidepy_context's moduledoc caught up with the callback pipe, and the modules owning a resource open with what they own, who they talk to and what they never do.