Make the thread_signal_deliverable comment match its acquire loads
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 80/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- documentation
Research direction
Read the comment above thread_signal_deliverable in src/runtime/thread.h, then the scan in src/runtime/thread.c that uses THREAD_FOR_EACH_ACTIVE_RELAXED and thread_blocked_load. Check commit 7bfe357 for why the acquire loads are intentional, and keep the explanation of why stale reads are benign. Done means the header no longer claims relaxed reads, and if you take the optional rename, every grep hit for the macro is updated and the tree still builds.
Written by the indexing model from the issue text.
Description
Problem
The comment above thread_signal_deliverable in src/runtime/thread.h says it "uses relaxed reads on per-thread blocked fields". The code does not: the scan in src/runtime/thread.c walks THREAD_FOR_EACH_ACTIVE_RELAXED, which loads active with memory_order_acquire, and reads each mask through thread_blocked_load, which also uses memory_order_acquire. A reader who trusts the header comment would assume weaker ordering than the code gives, and the macro name ..._RELAXED points the same wrong way.
Proposal
Drop the ordering claim from the header comment and describe it as the lock-free scan it is ("Lock-free scan of the per-thread blocked fields; ..."), keeping the existing text on why stale reads are benign. Optionally rename THREAD_FOR_EACH_ACTIVE_RELAXED to THREAD_FOR_EACH_ACTIVE_LOCKFREE, since "relaxed" there means "without thread_lock", not memory_order_relaxed. Comment-only, or a mechanical rename; no behavior change.
Alternatives
Change the loads to memory_order_relaxed to match the comment. Not proposed: the acquire loads came in with 7bfe357 ("Move shared state to C11 atomics"), and nothing here shows they are unneeded.
Origin
Found during review of #505, where cubic flagged the same wording on the new thread_signal_blocked_any comment and it was fixed there.
- Dominant language
- C
- Stars
- 287
- Forks
- 33
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sysprog21/elfuse
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 2 days
All issues in sysprog21/elfuse
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
llvm:instcombine
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
llvm/llvm-project#246503 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day