Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > .NET Framework

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-2008, 09:11 AM
=?Utf-8?B?Q2hyaXMgTWFyc2g=?=
 
Posts: n/a
Timers - Which to choose?

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
Reply With Quote
  #2 (permalink)  
Old 07-23-2008, 09:46 AM
Pavel Minaev
 
Posts: n/a
Re: Timers - Which to choose?

On Jul 23, 1:11*pm, Chris Marsh <ChrisMa...@discussions.microsoft.com>
wrote:
> 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.


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.
Reply With Quote
  #3 (permalink)  
Old 07-23-2008, 11:03 AM
=?Utf-8?B?Q2hyaXMgTWFyc2g=?=
 
Posts: n/a
Re: Timers - Which to choose?

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
Reply With Quote
  #4 (permalink)  
Old 07-23-2008, 02:57 PM
sloan
 
Posts: n/a
Re: Timers - Which to choose?

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



Reply With Quote
  #5 (permalink)  
Old 07-23-2008, 05:13 PM
=?Utf-8?B?Q2hyaXMgTWFyc2g=?=
 
Posts: n/a
Re: Timers - Which to choose?

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

>
>
>

Reply With Quote
  #6 (permalink)  
Old 07-25-2008, 03:49 PM
sloan
 
Posts: n/a
Re: Timers - Which to choose?

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

>>
>>
>>



Reply With Quote
  #7 (permalink)  
Old 07-29-2008, 10:49 AM
=?Utf-8?B?Q2hyaXMgTWFyc2g=?=
 
Posts: n/a
Re: Timers - Which to choose?

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
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > .NET Framework


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:43 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109