Re: Problem using thread ??
- From: "Bruce Eitman [eMVP]" <beitman.nospam@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Mar 2008 13:22:58 -0400
Okay, that confims that you are actually using an interrupt, I was
suspicious.
You should confirm the thread priorities. Especially since you tell us that
you are running at thread priority NORMAL, that is a term from CE 3.0 that
really doesn't apply since then.
Also, is it possible that the low priority thread is doing something causes
a high priority thread in one of your drivers to run? 50 is very high, but
there are 49 priorities higher.
--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net
Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
"fred_d" <duchassin@xxxxxxxxx> wrote in message
news:fr8n38$46n$1@xxxxxxxxxxxxxxxxxxxxx
The interrupt is initialized like this:
pTimerReg = MapRegister(TIMER_BASE);
pTimerReg->omcr5 = OMCRX_C | OMCRX_P | OMCRX_S | OMCRX_R |
OMCRX_CRES_1mS;//match control regsiter
pTimerReg->osmr5 = cDureeITPrimaire; // 10 ms
pTimerReg->oier |= OIER_E5; //interrupt enable E4
pTimerReg->oscr5 = 0x0000; //init à 0
// Create an Event to wait on
g_TimerEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &TimerIrq, sizeof(DWORD),
&g_Timerintr, sizeof(DWORD), NULL);
// Link our Event with the SYSINTR
test = InterruptInitialize(g_Timerintr, g_TimerEvent, NULL, 0);
ThreadIT = CreateThread(NULL, 0, Interrupt10ms, GlobalHwnd,
CREATE_SUSPENDED, NULL);
CeSetThreadPriority(ThreadIT, 50);
ResumeThread(ThreadIT);//pr démarrer la tache //
And the Boucle in the thread interrupt is like this:
DWORD WINAPI Interrupt10ms (LPVOID pParam)
{
while(1)
{
WaitForSingleObject(g_TimerEvent, /*INFINITE*/10000); //Attente :
Time_Out:1sec
if((pTimerReg->ossr & OSSR_M5) == OSSR_M5) //verifie que l'it provienne
bien du bon timer
{
pTimerReg->ossr |= OSSR_M5;
TraiteIT10ms();//-->traitement IT
InterruptDone(g_Timerintr);
}
if(QuitThread) break;
}
ExitThread(WM_QUIT);
return 0;
}
The source of the interrupt is a timer interrupt. I use OS5 timer to
generate an interrupt.
Thanks to help me.
Fred
"Bruce Eitman [eMVP]" <beitman.nospam@xxxxxxxxxxxxxxxxxxxxxx> a écrit dans
le message de news: %23wwaCpEhIHA.5900@xxxxxxxxxxxxxxxxxxxxxxx
How do you define interrupt? What is the source of the interrupt?
--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net
Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
"fred_d" <duchassin@xxxxxxxxx> wrote in message
news:fr8jil$2n3$1@xxxxxxxxxxxxxxxxxxxxx
Hello everybody,
I'm asking for help because i have problem with thread programming!
My application is runing under windows Ce 5. I use evc++ to make my
application.
In fact, my program is composed of 2 threads:
- One main thread which is the core of my application. Everythingh is
done in this thread. --> MAIN thread with priority NORMAL
-A thread which occurs every 10 ms. Every 10 ms, a timer interrupt
occurs and I control if a key is pressed. (if a key is pressed, i only
validate a flag and in the main thread, i do the action desired by this
flag). --> INTERRUPT thread with priority : 50 (high priority).
So you understand that the thread INTERRUPT wich occurs every 10 ms is
very important.
My problem is the following:
If in the main thread i have a boucle (a do...while for example) which
used a lot of CPU time (this thread has a normal priority).
At this time, I never go to the thread INTERRUPT whereas this thread has
a high priority !!! (sometimes i go in this thread 10 or 20 seconds
later !!!)
I don't knwo why !! I just would like to have a periodic interrupt...
Thanks to help me please.
Fred
.
- Follow-Ups:
- Re: Problem using thread ??
- From: fred_d
- Re: Problem using thread ??
- References:
- Problem using thread ??
- From: fred_d
- Re: Problem using thread ??
- From: Bruce Eitman [eMVP]
- Re: Problem using thread ??
- From: fred_d
- Problem using thread ??
- Prev by Date: Re: Problem using thread ??
- Next by Date: Re: Problem using thread ??
- Previous by thread: Re: Problem using thread ??
- Next by thread: Re: Problem using thread ??
- Index(es):