Re: Threads and Timing

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

From: Daniel Moth (dmoth74_at_hotmail.com)
Date: 03/23/05


Date: Wed, 23 Mar 2005 21:30:55 -0000

Just re-read my reply and it seems pretty clear. Have you got the code you
are running now and I can show exactly which changes to make if that helps.
Otherwise tell me which bit you don't understand...

Cheers
Daniel

--
http://www.danielmoth.com/Blog/
"Samer Saghir" <SamerSaghir@discussions.microsoft.com> wrote in message 
news:A0F62844-1D9E-4DA1-93CB-363298E4E493@microsoft.com...
>I posted this on the Windows CE Application Development newsgroup and was
> told to post it here:
>
>>Hey,
>>I'm trying to get a peice of code to run repeatedly every X seconds and 
>>the whole
>>thing shouldn't run for more than Y seconds.
>>
>>I tried using System.Threading.Timer and the period does the repeating 
>>forme
>>but I have two problems:
>
>>1 - The period has nothing to do with whether the code has finished 
>>executing or
>>not. So if the code requires 2 seconds to run and I specified a 1 sec 
>>repeat period
>>it would run every second and not a second after the one before finished
>>exceuting. (I've done some research and it seems that in regular .NET this 
>>can be
>>solved by joining threads anything similar or workaround for .NETCF??)
>>
>>2 - I have to have a seperate thread running to moniter the overall time, 
>>can I
>>avoid that?
>>
>>Thanks for the help
>>Samer
>
>>>You should chain your timer events - do not use the period (use -1 
>>>instead
>>>for that parameter). I.e. when the timer expires, run your code and start
>>>the one-shot timer again with X.
>>>
>>>For your second requirement the easiest way is to have a separate timer
>>>running for Y. When it expires stop your first timer.
>>>
>>>The CF ng is best for CF questions:
>>>microsoft.public.dotnet.framework.compactframework
>>>
>>>Cheers
>>>Daniel
>>>--
>>>http://www.danielmoth.com/Blog/
>
>
> I'm not sure I understand your suggestions....can you explain further a 
> bit?
> Thanks
> Samer
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> Check out my blog at:
> samersaghir.blogspot.com 


Relevant Pages

  • Re: Threads and Timing
    ... "Samer Saghir" wrote in message ... >>>>I tried using System.Threading.Timer and the period does the repeating>>forme>>but I have two problems:>>>1 - The period has nothing to do with whether the code has finished>>executing or>>not. ... I.e. when the timer expires, run your code and start>>>the one-shot timer again with X.>>>>>>For your second requirement the easiest way is to have a separate timer>>>running for Y. When it expires stop your first timer. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Threads and Timing
    ... You should chain your timer events - do not use the period (use -1 instead ... I.e. when the timer expires, ... > I tried using System.Threading.Timer and the period does the repeating for ... > 2 - I have to have a seperate thread running to moniter the overall time, ...
    (microsoft.public.windowsce.app.development)
  • Re: Threads and Timing
    ... Changewill stop the timer. ... if the timer expires right at the moment you try to stop it then ... > "Daniel Moth" wrote: ... >>>>I tried using System.Threading.Timer and the period does the repeating ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Windows Service stopped working
    ... between the start of the service to 2AM, and sets the timer. ... timer expires, it re-reads the configuration file ... Dim MyLog As New EventLog ...
    (microsoft.public.dotnet.languages.vb)
  • termios VMIN and VTIME behavior
    ... instead of waiting for either the timer to expire or VMIN bytes. ... In non-canonical mode input processing, ... TIME serves as an inter-byte timer which shall be activated ... If the timer expires before MIN ...
    (Linux-Kernel)