The last step in a Motif application is to enter the event loop. Most applications simply call XtAppMainLoop. This routine waits for user input and dispatches the resulting events to the appropriate event-handling procedures, usually in the widget in which the input occurs. XtAppMainLoop is an infinite loop; it never returns. An application should provide for a user action to terminate the program and should exit as a result of that action, usually in a callback routine.