Created
March 8, 2022 17:33
-
-
Save nikcleju/15875bcfe366ca17be6518c3e8ed593f to your computer and use it in GitHub Desktop.
Revisions
-
nikcleju created this gist
Mar 8, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #include <iostream> #include <thread> #include <chrono> #include "xcpp/xdisplay.hpp" void threadFunc() { using namespace std::chrono_literals; int repeat = 30; for (int i=0; i < repeat; i++) { std::cout << "(Keep alive "<< i+1 << "/" << repeat << ")" << std::endl << std::flush; // Sleep this thread for 300 Seconds std::this_thread::sleep_for(290s); //300000ms = 300s = 5 min //xcpp::clear_output(true); // prevents flickering } std::cout << "(Keep alive finished)"; } //threadFunc() std::thread th(&threadFunc); th.detach();