The Linux Programming Interface
Signals: Advanced Features 477 The sigblock() function adds a set of signals to the process signal mask. It is analo- gous to th ...
478 Chapter 22 Although signals can be viewed as a method of IPC, many factors make them generally unsuitable for this purpose, ...
TIMERS AND SLEEPING A timer allows a process to schedule a notification for itself to occur at some time in the future. Sleeping ...
480 Chapter 23 Using setitimer(), a process can establish three different types of timers, by specify- ing which as one of the f ...
Timers and Sleeping 481 to which. If we call setitimer() with both fields of new_value.it_value set to 0, then any existing time ...
482 Chapter 23 Each time the timer expires, the SIGALRM handler is invoked, and it sets a global flag, gotAlarm w. Whenever this ...
Timers and Sleeping 483 if (gettimeofday(&curr, NULL) == -1) errExit("gettimeofday"); printf("%-7s %6.2f", msg, curr.tv_sec ...
484 Chapter 23 itv.it_interval.tv_sec = (argc > 3)? getLong(argv[3], 0, "int-secs") : 0; itv.it_interval.tv_usec = (argc > ...
Timers and Sleeping 485 An example of the use of alarm() is shown in Section 23.3. In some later example programs in this book, ...
486 Chapter 23 23.3 Setting Timeouts on Blocking Operations One use of real-time timers is to place an upper limit on the time f ...
Timers and Sleeping 487 sa.sa_handler = handler; if (sigaction(SIGALRM, &sa, NULL) == -1) errExit("sigaction"); alarm((argc ...
488 Chapter 23 If the sleep completes, sleep() returns 0. If the sleep is interrupted by a signal, sleep() returns the number of ...
Timers and Sleeping 489 this program expects seconds and nanosecond values for nanosleep(). The program loops repeatedly, execut ...
490 Chapter 23 Listing 23-3: Using nanosleep() ––––––––––––––––––––––––––––––––––––––––––––––––––––––timers/t_nanosleep.c #defin ...
Timers and Sleeping 491 request = remain; /* Next sleep is with remaining time */ } printf("Sleep complete\n"); exit(EXIT_SUCCES ...
492 Chapter 23 The CLOCK_REALTIME clock is a system-wide clock that measures wall-clock time. By contrast with the CLOCK_MONOTON ...
Timers and Sleeping 493 23.5.3 Obtaining the Clock ID of a Specific Process or Thread The functions described in this section al ...
494 Chapter 23 The request and remain arguments serve similar purposes to the analogous argu- ments for nanosleep(). By default ...
Timers and Sleeping 495 23.6 POSIX Interval Timers.............................................................................. ...
496 Chapter 23 The clockid can specify any of the values shown in Table 23-1, or the clockid value returned by clock_getcpuclock ...
«
22
23
24
25
26
27
28
29
30
31
»
Free download pdf