1
0

sleep 984 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. .TH SLEEP 2
  2. .SH NAME
  3. sleep, alarm \- delay, ask for delayed note
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. int sleep(long millisecs)
  11. .PP
  12. .B
  13. long alarm(unsigned long millisecs)
  14. .SH DESCRIPTION
  15. .I Sleep
  16. suspends the current process for the number
  17. of milliseconds specified by the argument.
  18. The actual suspension time may be a little more or less than
  19. the requested time. If
  20. .I millisecs
  21. is 0, the process
  22. gives up the CPU if another process is waiting to run, returning
  23. immediately if not.
  24. Sleep returns \-1 if interrupted, 0 otherwise.
  25. .PP
  26. .I Alarm
  27. causes an
  28. .B alarm
  29. note (see
  30. .IR notify (2))
  31. to be sent to the invoking process after the number of milliseconds
  32. given by the argument.
  33. Successive calls to
  34. .I alarm
  35. reset the alarm clock.
  36. A zero argument clears the alarm.
  37. The return value is the amount of time previously remaining in
  38. the alarm clock.
  39. .SH SOURCE
  40. .B /sys/src/libc/9syscall
  41. .SH SEE ALSO
  42. .IR intro (2)
  43. .SH DIAGNOSTICS
  44. These functions set
  45. .IR errstr .