Skip to content

Commit ace68c1

Browse files
Rob Patroclaude
andcommitted
Use explicit atomic load/store in CandidateOccurence copy ops
Use count_.store(toCopy.count_.load(relaxed), relaxed) instead of going through a plain integer local. Consistent across both the copy constructor and assignment operator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 07eb89c commit ace68c1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎external/twopaco/graphconstructor/candidateoccurence.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ namespace TwoPaCo
5151

5252
CandidateOccurence(const CandidateOccurence & toCopy): body_(toCopy.body_)
5353
{
54-
int64_t val = toCopy.count_;
55-
count_ = val;
54+
count_.store(toCopy.count_.load(std::memory_order_relaxed),
55+
std::memory_order_relaxed);
5656
}
5757

5858
const CandidateOccurence & operator = (const CandidateOccurence & toCopy)
5959
{
6060
body_ = toCopy.body_;
61-
int64_t val = toCopy.count_;
62-
count_ = val;
61+
count_.store(toCopy.count_.load(std::memory_order_relaxed),
62+
std::memory_order_relaxed);
6363
return *this;
6464
}
6565

0 commit comments

Comments
 (0)