Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 2004 11:45:39 +0800
From:      <yangshazhou@hotmail.com>
To:        <freebsd-hackers@freebsd.org>
Subject:   yield() in kernel CAN'T yield control for MOD_LOAD thread
Message-ID:  <BAY17-DAV2Nl4iZWw8g0001c648@hotmail.com>

next in thread | raw e-mail | index | archive | help
>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.You mean, msleep(ident,...) in
one module and wakeup(ident) in the other till the second module run out?But
why yield() can't yield? It's because of the priority?
I'll try msleep/wakeup anyway, thanks.
-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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