event loop

(redirected from run 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 ?
Fabric-only devices, those that do not run loop, can, of course, be run on a switch.
We tentatively assert that, with sufficiently clever coding and for sufficiently large n, a 1024-processor CM-5 should be able to run Loop B somewhat faster than does an 8-processor Cray Y-MP C90.
And vintage double-decker buses owned by Merseyside Transport Trust will run loops between venues once again.
Some things this year are identical like my treadmill sets, run loops, bike intervals and loops, but I have made some changes," explained the Brisbane mother, who crossed Abu Dhabi's finish line last year with daughter Savannah in her arms to rapturous applause after holding off late charges from Angela Neath, Caroline Steffen and Melissa Hauschildt (nee Rollison), who are all returning to challenge her top spot.
Some runners in hot areas run loops around their neighborhood and let the hose run over their head each lap.