Using timers

Having looked at all this wonderful theory, let's turn our attention to some specific code samples to see what you can do with timers.

To work with a timer, you must:

  1. Create the timer object.
  2. Decide how you wish to be notified (signal, pulse, or thread creation), and create the notification structure (the struct sigevent).
  3. Decide what kind of timer you wish to have (relative versus absolute, and one-shot versus periodic).
  4. Start it.

Let's look at these in order.