Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 23:06:57 +0100
From:      Max Laier <max@love2party.net>
To:        freebsd-current@freebsd.org, barney_cordoba@yahoo.com
Cc:        Julian Elischer <julian@elischer.org>, current@freebsd.org
Subject:   Re: Is there a delay which yields?
Message-ID:  <200903192306.57780.max@love2party.net>
In-Reply-To: <258770.46329.qm@web63908.mail.re1.yahoo.com>
References:  <258770.46329.qm@web63908.mail.re1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 19 March 2009 23:02:49 Barney Cordoba wrote:
> --- On Thu, 3/19/09, John Baldwin <jhb@freebsd.org> wrote:
> > From: John Baldwin <jhb@freebsd.org>
> > Subject: Re: Is there a delay which yields?
> > To: freebsd-current@freebsd.org, barney_cordoba@yahoo.com
> > Cc: "Julian Elischer" <julian@elischer.org>, current@freebsd.org
> > Date: Thursday, March 19, 2009, 11:23 AM
> >
> > On Sunday 15 March 2009 2:43:18 pm Barney Cordoba wrote:
> > > --- On Sun, 3/15/09, Julian Elischer
> >
> > <julian@elischer.org> wrote:
> > > > From: Julian Elischer <julian@elischer.org>
> > > > Subject: Re: Is there a delay which yields?
> > > > To: barney_cordoba@yahoo.com
> > > > Cc: current@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).
>
> timo is in hz? So 1/1000th of a second by default?

tvtohz() (see time.h) will help you figure out how many ticks you need for a 
given timeval.

> Also, I notice that hz is 1000 but get 2000 ints/second per
> cpu. Why is it twice hz?

That I don't know.

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903192306.57780.max>