April 2020
Intermediate to advanced
412 pages
9h 58m
English
In our application, we are going to create a simple iterative function that runs in the background, along with the monitoring loop running in the main thread.
#include <iostream>#include <chrono>#include <atomic>#include <mutex>#include <thread>auto touched = std::chrono::steady_clock::now();std::mutex m;std::atomic_bool ready{ false };
void Worker() { for (int i = 0; i < 10; i++) { std::this_thread::sleep_for( std::chrono::milliseconds(100 ...