setitimer () Set value of an interval timer For example, an a ITIMERVIRTUAL timer will mark execution time for just. linux-programming-by-example - C code from the book 'Linux Programming by Example' (void) setitimer (ITIMERREAL, NULL, NULL) / turn off timer /. This structure is used to specify when a timer should expire. There is an example showing the use of the alarm function in Handler Returns. The alarm function, declared in unistd.h', provides a somewhat simpler interface for setting the real-time timer. This facility is declared in the header file sys/time.h'. SIGALRM will be received after seconds seconds and its processing function will be executed. The setitimer function is the primary means for setting an alarm. Coupled with ITIMERVIR-TUAL, this timer is usually used to profile the time. Probably the most useful tools to help people keep their meetings or presentations to. ITIMERPROF decrements both when the process executes and when the system is executing on behalf of the process. Image of meeting timer or presentation timer. Return Value: Returns the remaining seconds of the previous alarm, or 0 if no alarm was set before.Īfter the alarm () is executed, the process will continue to execute. ITIMERVIRTUAL decrements only when the process is execut- ing, and delivers SIGVTALRM upon expira- tion. If the parameter seconds is 0, the previously set alarm clock will be canceled and the remaining time will be returned. If you don't need to be very precise, it is enough to use alarm() and signal()įunction description: alarm() is used to set the signal SIGALRM after the parameter seconds Sent to the current process after the specified number of seconds. There are two types of timers under Linux, which are introduced as follows:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |