I am trying to do timer function that refresh every 1 second for special events.
The problem is that if i used while
+ Sleep(1000)
or for
loop + Sleep(1000)
, it doesn't load the other functions under it, so I am looking for solution.
I tried the following:
void Timer(){
while(true){
// events
if(Get_Current_Minute == Event_Minute)
// do event
Sleep(1000);
}
}
int Main(){
std::cout << " Hello " << std::endl; // loaded
Function() // loaded;
Timer(); // the timer function
std::cout << " Other functions " << std::endl; // not loaded
Function_2() // not loaded
}
So what can be the solution? I want to load everything in my application + there be a timer refresh every 1 second for the events.