home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / signal / itimer.txh < prev    next >
Encoding:
Text File  |  1995-07-21  |  1.7 KB  |  55 lines

  1. @node getitimer, process
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <sys/time.h>
  6.  
  7. int getitimer(int which, struct itimerval *value);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function gets the current value of the interval timer specified by
  13. @var{which} into structure @var{value}.  Variable @var{which} can have
  14. the value of ITIMER_REAL or ITIMER_PROF. @xref{setitimer}.
  15.  
  16. @subheading Return Value
  17.  
  18. Returns 0 on success, -1 on failure (and sets errno).
  19.  
  20. @c ----------------------------------------------------------------------
  21. @node setitimer, process
  22. @subheading Syntax
  23.  
  24. @example
  25. #include <sys/time.h>
  26.  
  27. struct itimerval @{
  28.   struct timeval it_interval;    /* timer interval */
  29.   struct timeval it_value;       /* current value */
  30. @};
  31.  
  32. int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
  33. @end example
  34.  
  35. @subheading Description
  36.  
  37. Each process has two interval timers, ITIMER_REAL and ITIMER_PROF, which
  38. signal SIGALRM and SIGPROF respectively.  These are typically used to
  39. provide alarm() and profiling capabilities.
  40.  
  41. This function changes the current value of the interval timer specified by
  42. @var{which} to the values in structure @var{value}.  The previous value
  43. of the timer is returned if @var{ovalue} is not NULL.  When the timer
  44. expires the appropriate signal is raised.
  45.  
  46. A timer is defined by the itimerval structure.  If it_value is non-zero it
  47. specifies the time to the next timer expiration.  If it_interval is non-zero
  48. it specifies the value to reload into it_value on timer expiration.  Setting
  49. it_value to zero disables a timer.  Setting it_interval to zero causes the
  50. timer to only happen once instead of repeating.
  51.  
  52. @subheading Return Value
  53.  
  54. Returns 0 on success, -1 on failure (and sets errno).
  55.