messagepump
Message pump, also called a message loop, is a core control flow construct in many GUI toolkits. It is a loop that runs on a thread and retrieves, translates, and dispatches messages or events from the system or other parts of the program. The pump coordinates input handling, painting, timers, and other asynchronous activities, ensuring that the user interface remains responsive.
In the Windows API, the typical pump repeatedly calls GetMessage to retrieve the next message from the
Other GUI frameworks implement analogous event loops. For example, Cocoa uses run loops (NSRunLoop) to schedule
Because the loop runs on the UI thread, long-running work should be offloaded to background threads or
Historically named from Windows programming, the message pump remains a foundational pattern for event-driven GUI programming