Doubt related to windows based timer.

  • Thread starter Thread starter archana
  • Start date Start date
A

archana

Hi all,

I am having one confusion regarding windows based timer.

I read somewhere that

'Be careful with stopping, because stopped timers are disabled and are
subject to garbage collection. That means that stopped timers can not
be started again.'


I have one application containing start and stop and i am using windows
based timer.

But after clicking on stop and starting the timer again it is working
properly. And i haven't reinitialize timer object.

I am not getting whether statement which i mention above is right and
am i doing something wrong.

Please correct me if i am wrong.

Thanks in advance.
 
This quote doesn't sound right to me...

Garbage collection only occurs when something goes out of sight of all
accessible objects (allowing for weak-references) - so if you can still see
it, it shouldn't be collected... and if you /can't/ see it (and it is
stopped, so not firing any events), then you can't restart it anyhows...

I'm willing to believe I could be wrong, though!

Marc
 
Hi,

archana said:
Hi all,

I am having one confusion regarding windows based timer.

I read somewhere that

'Be careful with stopping, because stopped timers are disabled and are
subject to garbage collection. That means that stopped timers can not
be started again.'

Not completety right, it may say that a timer with no reference to it can be
GC if stopped.
If you keep a reference to the timer it will not be GC'ed and will behave as
another regular object.

Where did you read that ?
 
Back
Top