I have a working piece of code on main function in Windows with C++ like:
some_handle = dll_generate_handle;
while(true) {
if(WaitForSingleObject(some_handle,100)){
//CODE I AM INTERESTED ABOUT
}
}
The signal comes from a dll function. I attempt to port this principle into a framework in the next manner:
I have a main again but this main gets the static instance of a class i1. This class has a member function "event_checking" doing the same piece of code above.
I can access to this event_checking function through an instance i2 of an intermediate class so I decided to Wrap i1.event_checking with
void eventCheckingWrapper(){ i1.event_checking(); }
Still in the main I spawn a thread on eventCheckingWrapper. So I am not interested in the thread returning as long as signals arrive. An example of this principle could be:
std::thread t(&ClassName::eventCheckingWrapper, &i2);
The thread is running well but no signals are arriving such that the timeout is always reached and the thread starts over in its while loop.
How can I properly get this to work?