Subject: Re: delay(9)
To: John Nemeth <jnemeth@victoria.tc.ca>
From: Tobias Nygren <tnn+nbsd@nygren.pp.se>
List: tech-kern
Date: 03/24/2007 16:18:27
John Nemeth wrote:
>      The manpage for delay(9)/DELAY(9) states that DELAY(9) is safe for
> use in interrupt context.  To me, this implies that delay(9) might not
> be safe for use in interrupt context (otherwise why mention it?).  So,
> is it okay to use delay(9) in interrupt context?  Either way, the
> manpage should be adjusted to clarify this.
>   

Hello,

On most (if not all?) ports DELAY is equivalent to delay, so this is
mostly a historical thing. I think the manual page is pretty clear
on the point that DELAY is guaranteed to be safe for reentrancy.
It's not safe (in MI code) to use delay in an interrupt handler
because the interrupt may have occurred while processing a delay
call. Then we'd enter delay twice in the same context.

HTH,
-Tobias