event loop

(redirected from Program 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.

Functions
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.

While
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.

Switch
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 ?
I also had to trick it with an unsolvable program loop to achieve the high number of cycles.
The primary benefit of this control system, according to Conair, is the virtual elimination of "latency time," the amount of time required for the program loop to monitor incoming length information, check it against the programmed length, and signal the cut.
Programming consists of a mix of news and current affairs, education, entertainment, lifestyle and sport, operating initially as a four hour repeating program loop, refreshed with up to date news services.
The programs are broadcast on cable 24/7, but these are usually to program loops of about 1-2 hours long, which are to be updated weekly according to organizers daily.
In (Kovacs, 2008) an automated framework for the verification of program loops is introduced.
For example, Mathcad 13 includes powerful new program debugging capabilities, including the ability to insert traces and step through program loops, to enhance auditing and verification.

Full browser ?