iter block performs one iteration of the main loop. If block
is true the function must blocks until one event become
available, otherwise it should just check for available events
and return immediatly.