<mutex>: Further improve call_once performance by using atomic CAS and WaitOnAddress
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
More aggressive in direction of #606
Call once on atomic operations, directly in header, something like what currently call_once XP fallback is, but doing std::atomic<char>::wait instead of continuous spinning.
(std::atomic<char>::wait will spin a bit by itself before going to kernel wait, either inside WaitOnAddress or in a fallback)
So fast path is header only and fully inlined into caller.
ODR-breaking, since stopping using INIT_ONCE structure.
vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.
Contributor 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.
Research direction
Start by reading issue #606 and the current call_once XP fallback, then examine how INIT_ONCE is used and where the implementation is exposed in headers. The proposed direction is atomic CAS with std::atomic<char>::wait and WaitOnAddress; completion depends on the vNext branch because the change breaks binary compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100