- wait-event! #!optional result-eventprocedure
- wait-event-timeout! timeout #!optional result-eventprocedure
Wait for the next event to appear on the event queue, then return it. The returned event will be removed from the event queue. If there is already an event on the event queue, it will be returned immediately. Otherwise, these procedures will block the current thread until the next event appears (or the timeout expires).
- wait-event! will wait indefinitely for an event to appear.
- wait-event-timeout! will stop waiting and return #f if no event appears within timeout milliseconds. (It may actually wait a few milliseconds longer than specified. You should not rely on its timing being very precise.)
If result-event is omitted or #f, a new managed sdl2:event will be returned. If result-event is an sdl2:event, it will be modified and returned. This allows you to allocate a single event and reuse it many times in your event loop, so that your program does not create as much garbage for the garbage collector.
These procedures are compatible with SRFI-18 multithreading. Only the current thread will block while waiting. Other threads will continue as normal.