Basically what I am trying to do here is to create an event system for a simple game engine I am working on.
I'm trying to make this program as platform independent as possible with the C++ language so I am ruling out threading for the moment.
The basic idea that is that:
//outside game loop (initialization) o_check_for_events(O_CHECK_ALL_EVENTS); // this should add the events to some sort of list // inside game loop event = o_get_next_event(); // return the next event in the queue // .. // do stuff with events
That would be a sample game event loop. What I want out of this though is an option that I can ask the system to wait for an event (easier of the two) and/or be able to check for events even while the game is running.
What I want to know is if it is more efficient to have methods that interrupt the flow for a short period of time, or else a threaded program that checks for events simultaneously (assume that the thread functions are safe)?