event loop

(redirected from Message loop)

event loop

A programming structure that continually tests for external events and calls the appropriate routines to handle them. An event loop is often the main loop in a program that typically waits for the user to trigger something. The following example is the main loop in the first software engine for this encyclopedia. Written in Turbo C, the main loop is constantly testing for menu selections, keystrokes and mouse clicks.

The statements with double parentheses are calls to functions (subroutines). For example, the bookmark() function creates a bookmark, and control is returned to the break statement. Break creates a go-to instruction to the beginning of the loop.

The while (1) statement creates a continuous loop until some condition is satisfied. In this example, the (1) means always true and keeps looping continuously. At the bottom (END OF EVENT LOOP), the curly brace (}) tells the compiler to insert a go-to instruction at that point that jumps to the beginning of the loop.

When testing for several conditions, the switch statement saves the programmer from having to write compare statements multiple times (if something is equal to, greater than or less than something else). In this example, the numbers are keyboard key codes (what key was just pressed?). See C, curly brace, event, event handler and event driven.

References in periodicals archive ?
Otherwise, P is dropped to avoid the possible message loop in the network.
Because the data diffusion has a clear direction, the number of message loop has been decreased, and the data transmission delay is also significantly reduced.
bengoldacre: The Boris Johnson recorded message loop at Kings Cross is a brilliant lesson in how to make your city feel like a sinister dictatorship.
Online interactivity 1) includes a message loop, 2) occurs from the learner's point of view, 3) provides for content and affective outcomes, and 4) is mutually coherent.
Our challenge is to ensure the message loop is complete from the student's point of view, and to make appropriate changes.
I rang the box office as soon as it opened and just kept getting the message loop.
The messages are then inserted into the message loop, which plays continuously.
After the Windows application makes the subroutine call, TI-RPC manages the message loop.
a message loop has occurred from the teacher's perspective.