All

I have a MonitorClient class, which will control a number of monitor classes
implementing an IMonitor interface. These monitor classes will monitor
various different things on a server. Each monitor class will have a
differently timed cycle on which to perform its probing.

My question is: which Timer class woudl it be better to use within the
monitor classes - System.Threading.Timer, or System.Timers.Timer? I've read
up on both, but cannot really see which suits my requirements better. Both
seem to use a new worker thread from the CLR thread pool on which to raise
their events, so I cannot immediately see a benefit to using one or the other
for my particular scenario.

Any advice very much appreciated.

Cheers!

--
Regards

Chris Marsh

Re: Timers - Which to choose? by Pavel

Pavel
Wed Jul 23 04:46:29 CDT 2008

On Jul 23, 1:11=A0pm, Chris Marsh <ChrisMa...@discussions.microsoft.com>
wrote:
> All
>
> I have a MonitorClient class, which will control a number of monitor clas=
ses
> implementing an IMonitor interface. These monitor classes will monitor
> various different things on a server. Each monitor class will have a
> differently timed cycle on which to perform its probing.
>
> My question is: which Timer class woudl it be better to use within the
> monitor classes - System.Threading.Timer, or System.Timers.Timer? I've re=
ad
> up on both, but cannot really see which suits my requirements better. Bot=
h
> seem to use a new worker thread from the CLR thread pool on which to rais=
e
> their events, so I cannot immediately see a benefit to using one or the o=
ther
> for my particular scenario.

The only difference between the two I'm aware of is that Timers.Timer
is a component (and thus can be manupulated with the visual designer),
and that it has SynchronizationObject property. The latter technically
allows it to raise events on some specific thread, rather than on a
new threadpool thread. If you do not need either of those, then you'll
probably want to stick with Threading.Timer.

Re: Timers - Which to choose? by ChrisMarsh

ChrisMarsh
Wed Jul 23 06:03:01 CDT 2008

Pavel

[..]

"Pavel Minaev" wrote:
> The only difference between the two I'm aware of is that Timers.Timer
> is a component (and thus can be manupulated with the visual designer),
> and that it has SynchronizationObject property. The latter technically
> allows it to raise events on some specific thread, rather than on a
> new threadpool thread. If you do not need either of those, then you'll
> probably want to stick with Threading.Timer.

Thanks a lot for the information - I'll stick with System.Timers.Timer in
that case.

Cheers!

--
Regards

Chris Marsh

Re: Timers - Which to choose? by sloan

sloan
Wed Jul 23 09:57:33 CDT 2008

Comparing the Timer Classes in the .NET Framework Class Library
http://msdn.microsoft.com/en-us/magazine/cc164015.aspx

Perhaps this will help you pick one.





"Chris Marsh" <ChrisMarsh@discussions.microsoft.com> wrote in message
news:57611B58-88A1-46FD-8F2E-15B5AD173124@microsoft.com...
> All
>
> I have a MonitorClient class, which will control a number of monitor
> classes
> implementing an IMonitor interface. These monitor classes will monitor
> various different things on a server. Each monitor class will have a
> differently timed cycle on which to perform its probing.
>
> My question is: which Timer class woudl it be better to use within the
> monitor classes - System.Threading.Timer, or System.Timers.Timer? I've
> read
> up on both, but cannot really see which suits my requirements better. Both
> seem to use a new worker thread from the CLR thread pool on which to raise
> their events, so I cannot immediately see a benefit to using one or the
> other
> for my particular scenario.
>
> Any advice very much appreciated.
>
> Cheers!
>
> --
> Regards
>
> Chris Marsh



Re: Timers - Which to choose? by ChrisMarsh

ChrisMarsh
Wed Jul 23 12:13:01 CDT 2008

sloan

Many thanks for the link - I'll follow up on it this evening.

Cheers!

--
Regards

Chris Marsh

"sloan" wrote:

> Comparing the Timer Classes in the .NET Framework Class Library
> http://msdn.microsoft.com/en-us/magazine/cc164015.aspx
>
> Perhaps this will help you pick one.
>
>
>
>
>
> "Chris Marsh" <ChrisMarsh@discussions.microsoft.com> wrote in message
> news:57611B58-88A1-46FD-8F2E-15B5AD173124@microsoft.com...
> > All
> >
> > I have a MonitorClient class, which will control a number of monitor
> > classes
> > implementing an IMonitor interface. These monitor classes will monitor
> > various different things on a server. Each monitor class will have a
> > differently timed cycle on which to perform its probing.
> >
> > My question is: which Timer class woudl it be better to use within the
> > monitor classes - System.Threading.Timer, or System.Timers.Timer? I've
> > read
> > up on both, but cannot really see which suits my requirements better. Both
> > seem to use a new worker thread from the CLR thread pool on which to raise
> > their events, so I cannot immediately see a benefit to using one or the
> > other
> > for my particular scenario.
> >
> > Any advice very much appreciated.
> >
> > Cheers!
> >
> > --
> > Regards
> >
> > Chris Marsh
>
>
>

Re: Timers - Which to choose? by sloan

sloan
Fri Jul 25 10:49:57 CDT 2008

Another broken promise ::::::::::::sigh:::::::::::::::::::

Whoah is me :(

..

Just joking, hope you got it worked out.




"Chris Marsh" <ChrisMarsh@discussions.microsoft.com> wrote in message
news:B96422D5-6A41-496F-9B65-FC3B0D0A5EC1@microsoft.com...
> sloan
>
> Many thanks for the link - I'll follow up on it this evening.
>
> Cheers!
>
> --
> Regards
>
> Chris Marsh
>
> "sloan" wrote:
>
>> Comparing the Timer Classes in the .NET Framework Class Library
>> http://msdn.microsoft.com/en-us/magazine/cc164015.aspx
>>
>> Perhaps this will help you pick one.
>>
>>
>>
>>
>>
>> "Chris Marsh" <ChrisMarsh@discussions.microsoft.com> wrote in message
>> news:57611B58-88A1-46FD-8F2E-15B5AD173124@microsoft.com...
>> > All
>> >
>> > I have a MonitorClient class, which will control a number of monitor
>> > classes
>> > implementing an IMonitor interface. These monitor classes will monitor
>> > various different things on a server. Each monitor class will have a
>> > differently timed cycle on which to perform its probing.
>> >
>> > My question is: which Timer class woudl it be better to use within the
>> > monitor classes - System.Threading.Timer, or System.Timers.Timer? I've
>> > read
>> > up on both, but cannot really see which suits my requirements better.
>> > Both
>> > seem to use a new worker thread from the CLR thread pool on which to
>> > raise
>> > their events, so I cannot immediately see a benefit to using one or the
>> > other
>> > for my particular scenario.
>> >
>> > Any advice very much appreciated.
>> >
>> > Cheers!
>> >
>> > --
>> > Regards
>> >
>> > Chris Marsh
>>
>>
>>



Re: Timers - Which to choose? by ChrisMarsh

ChrisMarsh
Tue Jul 29 05:49:03 CDT 2008

sloan

"sloan" wrote:

> Another broken promise ::::::::::::sigh:::::::::::::::::::
>
> Whoah is me :(

Not at all, I really appreciate you taking the time to identify resources
for me.

> Just joking, hope you got it worked out.

I did, thank you. I used System.Timers.Timer on the grounds that I could
find no reason *not* to, and although System.Threading.Timers looked more
interesting I could not justify the work time to figure out how it worked :-)
One for the weekend, methinks...

Thanks again!

--
Regards

Chris Marsh