Re: Threads and Timing
From: Daniel Moth (dmoth74_at_hotmail.com)
Date: 03/21/05
- Next message: Daniel Moth: "Re: Styled controls?"
- Previous message: Corey Burke [MS]: "RE: FTP Problem under USB connection"
- In reply to: Samer Saghir: "Threads and Timing"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 21 Mar 2005 22:22:50 -0000
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/ "Samer Saghir" <SamerSaghir@discussions.microsoft.com> wrote in message news:AED18486-82F5-45D9-B048-983D3E62496C@microsoft.com... > 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 for > me 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 > regualr .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 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > Check out my blog at: > samersaghir.blogspot.com
- Next message: Daniel Moth: "Re: Styled controls?"
- Previous message: Corey Burke [MS]: "RE: FTP Problem under USB connection"
- In reply to: Samer Saghir: "Threads and Timing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|