23TIMERS AND SLEEPING
A timer allows a process to schedule a notification for itself to occur at some time in the future. Sleeping allows a process (or thread) to suspend execution for a period of time. This chapter describes the interfaces used for setting timers and for sleeping. It covers the following topics:
• the classical UNIX APIs for setting interval timers (setitimer() and alarm()) to notify a process when a certain amount of time has passed;
• the APIs that allow a process to sleep for a specified interval;
• the POSIX.1b clocks and timers APIs; and
• the Linux-specific timerfd facility, which allows the creation of timers whose expirations can be read from a file descriptor.
23.1 Interval Timers
The setitimer() system call establishes ...
Get The Linux Programming Interface 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.