From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 26 07:00:05 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 A6F7316A4D9 for ; Thu, 26 Aug 2004 07:00:05 +0000 (GMT) Received: from hotmail.com (bay17-dav17.bay17.hotmail.com [64.4.43.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9801443D5E for ; Thu, 26 Aug 2004 07:00:05 +0000 (GMT) (envelope-from yangshazhou@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 25 Aug 2004 23:39:26 -0700 Received: from 61.187.16.2 by bay17-dav17.bay17.hotmail.com with DAV; Thu, 26 Aug 2004 06:39:25 +0000 X-Originating-IP: [61.187.16.2] X-Originating-Email: [yangshazhou@hotmail.com] X-Sender: yangshazhou@hotmail.com From: To: Date: Thu, 26 Aug 2004 14:36:50 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: X-OriginalArrivalTime: 26 Aug 2004 06:39:26.0235 (UTC) FILETIME=[6E3FBEB0:01C48B37] X-Mailman-Approved-At: Thu, 26 Aug 2004 12:20:11 +0000 Subject: 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: Thu, 26 Aug 2004 07:00:05 -0000 Now "tsleep(&ident,PRIBIO,NULL,1)" solved the problem. Maybe yield() can't do the job in kernel. And mi_switch() is not enough to.Thank you.On Wednesday 25 August 2004 03:06 am, yangshazhou at 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