From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 25 20:50:32 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F422816A4CE for ; Wed, 25 Aug 2004 20:50:31 +0000 (GMT) Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FAC743D3F for ; Wed, 25 Aug 2004 20:50:29 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 23122 invoked from network); 25 Aug 2004 20:50:28 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 25 Aug 2004 20:50:28 -0000 Received: from [10.50.40.208] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i7PKoM3B005745; Wed, 25 Aug 2004 16:50:25 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-hackers@FreeBSD.org Date: Wed, 25 Aug 2004 13:14:47 -0400 User-Agent: KMail/1.6.2 References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Message-Id: <200408251314.47962.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: yangshazhou@hotmail.com Subject: Re: yield() in kernel CAN'T yield control for MOD_LOAD thread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2004 20:50:32 -0000 On Wednesday 25 August 2004 03:06 am, yangshazhou@hotmail.com wrote: > Hi all, > This problem delay me for quite a long time. > I've built two klds, I'd like to see the result one's running to the > other's. In one kld's MOD_LOAD subroutine, I make a long 'for' loop, in > which it DELAY(1000) and then call yield(curthread,NULL). When the module > was loaded by kldload, the system failed to response until the loop quit. > The loop seems like that: > for(i=0;i<8000;i++){ > ...... > DELAY(1000); > yield(curthread,NULL); > } > > My system is 5.2.1-release. Thanks. You could try having the first one wait on a condition variable that the second module's MOD_LOAD does a wakeup on. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org