POSIX interval timers – example programs

Programming is ultimately learned and understanding is deeply internalized by doing, not simply seeing or reading. Let's take our own advice and cut a couple of decent code examples, to illustrate using the POSIX (interval) timer APIs. (Of course, dear reader, it implies you do the same!)

The first sample program is a small CLI game of "how quickly can you react"? The second sample program is a simple implementation of a run-walk timer. Read on for the gory details.

Get Hands-On System Programming with Linux 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.