1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include "cmMod.hpp" #include <chrono> #include <thread> using namespace std::chrono_literals; void CmMod::asyncIncrement() { std::thread t1([this]() { std::this_thread::sleep_for(100ms); num += 1; }); t1.join(); }