python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Atomic variable vs Normal variable with locks in C++
Recently I gave an interview to a tech company and the interviewer asked me to tell which of the operation is faster among a normal increment operation on atomic variable and increment operation on a ...
Golden_panther
Votes: 0
Answers: 0
Can atomic_thread_fence(acquire) prevent previous loads being reordered after itself?
I understand atomic_thread_fence in C++ is quite different with atomic store/loads, and it is not a good practice to understand them by trying to interpret them into CPU(maybe x86)'s mfence/lfence/sfe...

calvin
Votes: 0
Answers: 1
Why set the stop flag using `memory_order_seq_cst`, if you check it with `memory_order_relaxed`?
Herb Sutter, in his "atomic<> weapons" talk, shows several example uses of atomics, and one of them boils down to following: (video link, timestamped)
A main thread launches several w...

HolyBlackCat
Votes: 0
Answers: 2
Are seq-cst fences exactly the same as acq-rel fences in absence of seq-cst loads?
I'm trying to understand the purpose of std::atomic_thread_fence(std::memory_order_seq_cst); fences, and how they're different from acq_rel fences.
So far my understanding is that the only difference ...

HolyBlackCat
Votes: 0
Answers: 3