Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in --d --h --m --s-- days -- hours -- minutes -- seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 07m 42s1 days 16 hours 7 minutes 42 seconds.
Guide: C++ Interview Questions for HFT and Quant Developer Roles · C++ for Quant Trading: A Step-by-Step Roadmap
Observe the code snippet below. What is the value returned by the load on data in thread 2?
std::atomic<bool> flag = false;
std::atomic<int> data = 0;
// Thread 1
data.store(42, std::memory_order_relaxed);
flag.store(true, std::memory_order_release);
// Thread 2
if (flag.load(std::memory_order_acquire)) {
std::cout << data.load(std::memory_order_relaxed);
}