Re: Is there a delay which yields?

From: John Baldwin <jhb_at_freebsd.org>
Date: Thu, 19 Mar 2009 11:23:44 -0400
On Sunday 15 March 2009 2:43:18 pm Barney Cordoba wrote:
> 
> --- On Sun, 3/15/09, Julian Elischer <julian_at_elischer.org> wrote:
> 
> > From: Julian Elischer <julian_at_elischer.org>
> > Subject: Re: Is there a delay which yields?
> > To: barney_cordoba_at_yahoo.com
> > Cc: current_at_freebsd.org
> > Date: Sunday, March 15, 2009, 1:16 PM
> > Barney Cordoba wrote:
> > > I'd expect DELAY to yield till timeout but a task
> > with a delay loop just
> > > runs to 100% usage. Is there a function which can
> > yield exectution for
> > > a set amount of time (without having to use a timer)?
> > 
> > DELAY is designe for use early in the boot when thre are no
> > timers.
> > it is only occasionally used for cases during normal
> > operation.
> > 
> > how would a thread know how long it has been away if no
> > timer is used?
> 
> 
> I guess I mean a sleep. 
> 
> Also, this is a kernel driver. I have a device
> which requires a toggle with a 10ms delay between pulses. I hate to 
> tie up the cpu for 10ms with a delay. Sort of like the following:
> 
> write_pulse();
> delay(10000);
> write_pulse();

Use pause(9).

-- 
John Baldwin
Received on Thu Mar 19 2009 - 14:58:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:44 UTC