Sets or changes the timeout of interval timers. Format #include <unistd.h> useconds_t ualarm (useconds_t mseconds, useconds_t interval);
1 – Arguments
mseconds Specifies a number of real-time microseconds. interval Specifies the interval for repeating the timer.
2 – Description
The ualarm function causes the SIGALRM signal to be generated for the calling process after the number of real-time microseconds specified by useconds has elapsed. When the interval argument is nonzero, repeated timeout notification occurs with a period in microseconds specified by interval. If the notification signal SIGALRM is not intercepted or is ignored, the calling process is terminated. If you call a combination of ualarm and setitimer functions, and the AST status is disabled, the return value is invalid. If you call a combination of ualarm and setitimer functions, and the AST status is enabled, the return value is valid. This is because you cannot invoke an AST handler to clear the previous value of the timer when ASTs are disabled or invoked from a handler that was invoked at AST level. NOTE Interactions between ualarm and either alarm, or sleep are unspecified. See also setitimer.
3 – Return Values
n The number of microseconds remaining from the previous ualarm or setitimer call. 0 No timeouts are pending or ualarm not previously called. -1 Indicates an error.