Hi.
Im writing a multithreaded application and each thread is going to have its event loop.
I do understand and idea of
while(GetEvents())
{
ProcessEvents(events);
}
However, I dont understand the idea of GetEvents(). How can I make a function wait for events to appear in the event loop without having some
while(1)
{
loop through events
if event found -> break and return the event
}
This has a potential problem of loading CPU when there are no events. I can of course use something like “pause” but I dont want to do this. Is there any tutorials or rules on how to create your own event processing ?