Re: windows ce 4.2 Sleep function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Please define "highest priority" do you mean that the priority is set to
zero? On further review, no that is not what you mean, you mean it is
THREAD_PRIORITY_TIME_CRITICAL which is a very low priority (248 on a scale
of 0-255 with zero being the highest). You need to raise your priority.

--
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


"Han" <Han@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F4A3FD70-0308-454A-ACB3-7347C0589F39@xxxxxxxxxxxxxxxx
>I create a thread as below:
>
> hThread1= CreateThread(NULL,0,Thread2,(PVOID)nParameter,0,&dwThread1ID);
> CeSetThreadPriority(hThread1,THREAD_PRIORITY_TIME_CRITICAL);
> CeSetThreadQuantum(hThread1,0);
>
> DWORD WINAPI Thread2(PVOID pARG)
> {
>
> register long i;
> volatile register long k=0;
> register long j=0;
> register long Maxv=0;
> long tick3=GetTickCount();
> long tick1=0;
> long tick5=0;
> long maxtick=0;
> long tick2=0;
>
>
> for (ii=0;ii<2000;ii++)
> {
> tick1=GetTickCount();
> for(i=0;i<100000;i++)
> {
> k++;
> }
>
> tick2=GetTickCount();
> if ((tick2-tick1)>Maxv)
> {
> Maxv=tick2-tick1;
> }
> Sleep(1);
> tick5=GetTickCount();
>
>
> if( (tick5-tick2)>maxtick)
> maxtick=tick5-tick2;
>
>
> printf("Max:%d Tick:%d Tic2: %d \r",Maxv,tick2-tick1,maxtick);
> }
>
> }
>
> in thread I am running a dummy loop to burn some cpu time, and sleep 1 ms
> to
> let other process do their job. I use tick5 and tick2 variables to check
> the
> return time diff. from sleep. The return time can be as high as 20-30 ms
> under load, or if I move mouse etc. The thread has the highest priority,
> and
> this is real time application which must be response in deterministic time
> around 2-3 ms, how can I do it with CE 4.2?
>
> I also tried to use WaitForSingleObject(thevent,1), I created an event
> which
> is never signalled, WaitForSingleObject is work as expected (timeout) but
> get
> same 20-30 ms delays.
>
> Regards,


.



Relevant Pages

  • IDirect3DResource9::SetPriority... What are the priority levels
    ... In the IDirect3DResource9::SetPriority call, ... Does 0 (zero) mean the highest priority? ... where 31 is the highest priority. ... Prev by Date: ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Dual data rate in Xilinx WebPACK 7.1
    ... I'd imagine a 'priority decoder': ... Priority encoders do exist. ... the synchronous building blocks in FPGAs (and ... then a synchronous reset of that register is required. ...
    (comp.lang.vhdl)
  • Re: Iterator Related Design Problem
    ... > I need to find the item with the highest priority that also meets some ... Let's say that other criteria is called criteria X. ... This seems to be a simple collection class problem. ... that maintains the priority order as Items are added. ...
    (comp.object)
  • Re: Linux 2.6.36-rc7
    ... Eric> backwards compatible) is that priority 0 is the last thing to be ... Eric> uses the interface it would use the highest priority. ... Hopefully they're processed in order of notifier creation instead. ... Thanks for the pointers, I'll try to find the time to look them over ...
    (Linux-Kernel)
  • Re: About VxWorks watchdog
    ... highest priority could not pet the dog as expected, ... to pet HW watchodg is good method. ... 0 is the highest task priority and HW watchdog maintenance ... should probably not be a real time system's highest priority. ...
    (comp.os.vxworks)