www.delorie.com/djgpp/doc/libc-2.01/libc_569.html   search  
Go to the first, previous, next, last section, table of contents.


setitimer

Syntax

#include <sys/time.h>

struct itimerval {
  struct timeval it_interval;    /* timer interval */
  struct timeval it_value;       /* current value */
};

int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);

Description

Each process has two interval timers, ITIMER_REAL and ITIMER_PROF, which signal SIGALRM and SIGPROF respectively. These are typically used to provide alarm() and profiling capabilities.

This function changes the current value of the interval timer specified by which to the values in structure value. The previous value of the timer is returned if ovalue is not NULL. When the timer expires the appropriate signal is raised.

A timer is defined by the itimerval structure. If it_value is non-zero it specifies the time to the next timer expiration. If it_interval is non-zero it specifies the value to reload into it_value on timer expiration. Setting it_value to zero disables a timer. Setting it_interval to zero causes the timer to only happen once instead of repeating.

Return Value

Returns 0 on success, -1 on failure (and sets errno).


Go to the first, previous, next, last section, table of contents.

  prev next   webmaster     delorie software   privacy  
  Copyright © 1997     Updated Apr 1997