Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. In computer
science, the event loop, message dispatcher, message loop or message
pump is a programming construct that waits for and dispatches events or
messages in a program. It works by polling some internal or external
"event provider", which generally blocks until an event has arrived, and
then calls the relevant event handler ("dispatches the event"). The
event-loop may be used in conjunction with a reactor, if the event
provider follows the file interface. The event loop almost always
operates asynchronously with the message originator. When the event loop
forms the central control flow construct of a program, as it often does,
and is thus at the highest level of control within the program, it may
be termed the main loop or main event loop.