Order the producer's write before the consumer's read

Fill in both blanks so the consumer is guaranteed to see the fully written payload once it observes ready == true.

main.cpp
std::atomic<bool> ready{false};
int payload = 0;
void producer() {
payload = 42;
ready.store(true, );
}
void consumer() {
while (!ready.load()) {}
std::cout << payload << std::endl;
}
97 of 117 in C++