Event-Driven Programming

Figure 27.1 shows a program that progresses from time T0 to T6 in two states: a processing state in which program instructions are executed and an input state in which program execution is suspended until user input arrives.

After some program initialization starting at time T0, the program ignores user input until it reaches time T1. At T1, the execution of the program is suspended until fgets(3) receives input (using an underlying read(2) system call). At time T1 the program is attentive to the user.

At time T2, however, the program is busy executing instructions that pertain to database queries and other non-input activities. The user cannot direct the flow of the program at this point.

Figure 27.1. Non–event-driven ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.