main loop

n.

The top-level control flow construct in an input- or event-driven program, the one which receives and acts or dispatches on the program's input. See also driver.