Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ Two more rules that catch most of the rest:
- **Read mutable shared state once per operation.** Re-reading the same field for several
decisions in one pass lets it change mid-pass, so the results disagree with each other.

Prefer `AutoClosableReentrantLock` over `synchronized`, matching the rest of the codebase.
**Which lock to use depends on the module.** In JVM and shared modules, including `sentry` core,
use `AutoClosableReentrantLock`: `synchronized` pins virtual threads on JDK 21–23. In Android-only
modules (`sentry-android-*`), use `synchronized`, since Android has no virtual threads. Don't rewrite
existing locks only to switch between the two.

### Measuring Time

Expand Down
4 changes: 3 additions & 1 deletion REVIEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ rule file in [`.cursor/rules/`](.cursor/rules) for the area the diff touches (`a
plain field read is a data race, not merely a stale value.
- Read mutable shared state once per operation. Re-reading the same field for several decisions in
one pass lets it change mid-pass, so the results disagree with each other.
- Prefer the `synchronized` keyword. Existing code that uses `AutoClosableReentrantLock` is legacy.
- In JVM and shared modules, including `sentry` core, use `AutoClosableReentrantLock`, not
`synchronized`, which pins virtual threads on JDK 21–23. In Android-only modules
(`sentry-android-*`), use `synchronized`. Don't flag existing locks that predate this rule.
- New classes have a clear and defined threading and concurrency model as part of the javadoc if
needed.

Expand Down
Loading