Re: question about thread scheduling
- From: "Remi de Gravelaine" <gravelaine at aton dash sys dot fr>
- Date: Fri, 16 Mar 2007 14:47:59 +0100
Zhiqiang,
You should try to tell us *exactly* what you want to do.
You should also avoid multiplying the discussion threads if you want people
to take care of you from the beginning.
If I understood what you want to do, you have implemented a polling loop to
do some job (what kind of job?) every 4ms.
You have put this loop in a high-priority thread started by the XXX_Init
function of a stream driver.
You are using CE 6.0 on a CEPC.
The loop should thus look like:
while (!g_bSuicide)
{
Sleep(3);
<do some job>
}
There is no reason that such a loop exits except when g_bSuicide is set to
TRUE (something that can be done in XXX_Deinit) or the <do some job> code
executes a break of goto intruction.
Now, why Sleep(3) instead of Sleep(4)? Because Sleep(3) will sleep for *at
least* 3 ms and because Sleep is synchonized on timer ticks, that fire every
ms (producing the SYSINTR_RESCHED you are focusing on.) So, Sleep(3) returns
from sleeping right after the third tick and a new 1ms slice begins. You <do
some job> during a portion of this slice and reenter Sleep(3). Sleep(3) puts
your thread to sleep for 3 timer ticks and that means the time remaining in
the current tick + 3 ms.
HTH
Remi
.
- Follow-Ups:
- Re: question about thread scheduling
- From: Zhiqiang Li
- Re: question about thread scheduling
- From: Zhiqiang Li
- Re: question about thread scheduling
- References:
- question about thread scheduling
- From: Zhiqiang Li
- question about thread scheduling
- Prev by Date: Re: Is CE6 really Real-Time???
- Next by Date: Re: Platform Builder license - "one place" or "multiplace" version?
- Previous by thread: question about thread scheduling
- Next by thread: Re: question about thread scheduling
- Index(es):
Relevant Pages
|