April 2020
Intermediate to advanced
412 pages
9h 58m
English
We are implementing an application that has a shared counter that is incremented by two concurrent worker threads.
#include <atomic>#include <chrono>#include <iostream>#include <thread>#include <vector>std::atomic<bool> running{true};std::atomic<int> counter{0};
void worker() { while(running) { counter.fetch_add(1, std::memory_order_relaxed); ...Read now
Unlock full access