Message from C, C++ talks

July 2019

— I guess he wants to avoid function pointers

— But i don't see why and there's std::function

— It is a kind of a surveillance program lol, take screenshot at a user-defined interval, send logs to server every n minutes etc

Message permanent page

— Using stl versus not using it

— 

void timer_start(std::function<void(void)> func, unsigned int interval)
{
std::thread([func, interval]()
{
while (true)
{
auto x = std::chrono::steady_clock::now() + std::chrono::milliseconds(interval);
func();
std::this_thread::sleep_until(x);
}
}).detach();
}


I found this from internet, it looks pretty good, just have to figure out how to end/change the interval of already-made periodic function call

— Mmm malware

— Not really

— I'm not writing a virus

— Spyware

— No

— Control software

— Hm

— Just virus?

— :DDD

— NO