commit 753c1f3ab968c3e119eed5aa3fa687430acccc04
parent 9c26ce6f794248678b0c0cedaad700107f0bfaed
Author: alltheseas <alltheseas@users.noreply.github.com>
Date: Fri, 2 Jan 2026 17:39:50 -0600
docs: add coding pattern for Mutex avoidance
Add pattern #14: Avoid Mutexes in favor of Promise, Rc<RefCell<>>,
or tokio::sync::RwLock. Mutexes can cause UI stalls if held across
frames in the immediate-mode render loop.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
@@ -117,6 +117,7 @@ This document captures the current architecture, coding conventions, and design
11. **Ensure docstring coverage** for any code added, or modified.
12. Run **cargo fmt, cargo clippy, cargo test**.
13. **Do not vendor code**. In cargo.toml replace the existing url with the fork that includes the new code. If vendoring is absolutely necessary you must present the case why no other options are feasible.
+14. **Avoid Mutexes** — prefer `poll_promise::Promise` for async results, `Rc<RefCell<>>` for single-threaded interior mutability, or `tokio::sync::RwLock` when cross-thread sharing is truly necessary. Mutexes can cause UI stalls if held across frames.