From owner-freebsd-current@FreeBSD.ORG Thu Mar 19 22:07:00 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CF6B1065674 for ; Thu, 19 Mar 2009 22:07:00 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id 948A48FC12 for ; Thu, 19 Mar 2009 22:06:59 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-045-044.pools.arcor-ip.net [88.66.45.44]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1LkQOA0z7n-0007TU; Thu, 19 Mar 2009 23:06:58 +0100 Received: (qmail 46611 invoked from network); 19 Mar 2009 22:06:58 -0000 Received: from fbsd8.laiers.local (192.168.4.200) by ns1.laiers.local with SMTP; 19 Mar 2009 22:06:58 -0000 From: Max Laier Organization: FreeBSD To: freebsd-current@freebsd.org, barney_cordoba@yahoo.com Date: Thu, 19 Mar 2009 23:06:57 +0100 User-Agent: KMail/1.11.0 (FreeBSD/8.0-CURRENT; KDE/4.2.1; i386; ; ) References: <258770.46329.qm@web63908.mail.re1.yahoo.com> In-Reply-To: <258770.46329.qm@web63908.mail.re1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903192306.57780.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19eLlUq+FnPLRQYj5BQSsAiVtxiCCMCjyuowPS DtDm47Nw6ZcpsNqg4OjrI0YMVhjgLEADhiGVxa/h9lVfoNgI/J VEB1ai5+PL973cuDTjySA== Cc: Julian Elischer , current@freebsd.org Subject: Re: Is there a delay which yields? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 22:07:00 -0000 On Thursday 19 March 2009 23:02:49 Barney Cordoba wrote: > --- On Thu, 3/19/09, John Baldwin wrote: > > From: John Baldwin > > Subject: Re: Is there a delay which yields? > > To: freebsd-current@freebsd.org, barney_cordoba@yahoo.com > > Cc: "Julian Elischer" , 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 > > > > wrote: > > > > From: Julian Elischer > > > > 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