Typical application workflow

The design approach (and APIs used) to set up and use a modern POSIX timer follows; the sequence is typically in the order shown here:

  • Signal(s) setup.
    • Assuming the notification mechanism being used is a signal, first trap the signal(s) via sigaction(2).
  • Create and initialize the timer(s).
    • Decide on the clock type (or source) to use to measure the elapsed time.
    • Decide on the timer-expiry event-notification mechanism to be used by your application—typically, whether to use (the usual) signals or a (newly spawned) thread.
    • The aforementioned decisions are implemented via the timer_create(2) system call; thereby it allows one to create a timer, and, of course, we can create multiple timers by invoking it multiple ...

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.