[1.0 Decision] Document the threading contract: mcrfpy.lock() is the rule for off-main-thread access #327
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#327
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the 2026-07-02 pre-1.0 memory-model review. The promise freezes at 1.0; the implementation can harden afterward.
What exists
The engine already has a deliberate concurrency design (#219):
mcrfpy.lock()->PyLockContext(src/PyLock.cpp): no-op on the main thread; on worker threads blocks (GIL released) until the main loop opens a safe window viaFrameLock(src/GameEngine.cpp:34-36, 493-499).display()(src/GameEngine.cpp:477-498) so worker threads get scheduled every frame.PyGILState_Ensure(src/Animation.cpp:707-770,src/PySceneObject.cpp:352-400).What's missing
A normative statement in the docs: any access to mcrfpy objects from a non-main thread must happen inside
with mcrfpy.lock():; behavior outside the lock is undefined. This coarse-grained contract works identically under GIL and free-threaded builds, and it is the promise that makes the free-threading hardening work (#336) tractable -- the engine never has to become internally thread-safe.Deliverables
mcrfpy.lock()docstring stating the contract (MCRF_* macros).Related: #220 (subinterpreters are the other concurrency model, deferred).