Chapter 17 . Timers

In Chapter 15, "Signals," you were introduced to the alarm(3) function, which enables you to create and cancel a timer. This function provides a timer service that has its time resolution measured in seconds.

This chapter will begin with a hypothetical implementation of the sleep(2) function call. This will provide additional insight into why there is a conflict between the use of alarm(3) and sleep(2). Later you'll learn that the conflict may extend to other UNIX functions.

This chapter also will introduce you to

  • Fine-grained timers such as usleep(3) and nanosleep(2)

  • The interval timer functions

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.