2019-11-19 20:30:40 +00:00
|
|
|
.TH DELAY 9
|
|
|
|
.SH NAME
|
|
|
|
delay, microdelay, addclock0link \- small delays, clock interrupts
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.ta \w'\fLTimer* 'u
|
|
|
|
.B
|
|
|
|
void delay(int ms)
|
|
|
|
.PP
|
|
|
|
.B
|
|
|
|
void microdelay(int µs)
|
|
|
|
.PP
|
|
|
|
.B
|
|
|
|
Timer* addclock0link(void(*clockf)(void), int ms)
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.I Delay
|
|
|
|
busy waits for
|
|
|
|
.I ms
|
2019-11-21 00:05:52 +00:00
|
|
|
milliseconds. The minimum value of
|
|
|
|
.I ms
|
|
|
|
is one on most architectures.
|
2019-11-19 20:30:40 +00:00
|
|
|
.PP
|
|
|
|
.I Microdelay
|
|
|
|
works exactly the same as
|
|
|
|
.I delay
|
|
|
|
but using microseconds instead.
|
|
|
|
.PP
|
2019-11-21 00:05:52 +00:00
|
|
|
These routines are intended for use in interrupt contexts,
|
|
|
|
device reset and shutdown functions, and other places where
|
|
|
|
the scheduler is unavailable.
|
|
|
|
When you have a process context, and can sleep, consider
|
|
|
|
.IR tsleep (9).
|
|
|
|
.I Tsleep
|
|
|
|
does not busy wait.
|
2019-11-19 20:30:40 +00:00
|
|
|
.PP
|
|
|
|
.I Addclock0link
|
|
|
|
adds a new periodic timer to the current processor's timer list, with
|
|
|
|
.I clockf
|
|
|
|
executing every
|
|
|
|
.I ms
|
|
|
|
milliseconds. If
|
|
|
|
.I ms
|
|
|
|
is zero a default clock is used, it will panic otherwise (i.e.
|
|
|
|
.I ms
|
|
|
|
< 0).
|
|
|
|
.SH SOURCE
|
|
|
|
.B /sys/src/9/port/portclock.c
|
|
|
|
.br
|
|
|
|
.B /sys/src/9/*/clock.c
|
|
|
|
.SH SEE ALSO
|
|
|
|
.IR sleep (9)
|