Quantcast
Channel: Dynamic Timers
Viewing all articles
Browse latest Browse all 5

Dynamic Timers

$
0
0

You can just use a collection of objects, which contains a reference to the timer. It may be possible to check the sender with the timers in your collection to see if they are the same object, then dispose of the timer and remove it from the collection.

Alternatively, you can use the Threading timer, which allows you to pass a reference to an object. This object is passed to expiration event of the timer, so you can have a direct reference to the object in the collection.

Of course, either method may require careful synchronization of the collection and objects (synclock works well as a generic method of synchronization, and also a lot of objects have built in synchronization methods, becuse they are expected to be used across multiple threads - doesn't mean they are naturally thread-safe, though).


Viewing all articles
Browse latest Browse all 5

Trending Articles


HOY PANGIT, MAGBAYAD KA!


Henry el monstruo feliz para colorear e imprimir


Dama y vagabundo para pintar


Girasoles para colorear


Good Morning Quotes


RE: Mutton Pies (jameskoiman)


Hagibis (1946) by Francisco V. Coching


Ka riam ka beit bad ka por riam


Vimeo Create - Video Maker & Editor 1.6.0 by Vimeo Inc


Vimeo 3.42.1 by Vimeo Inc



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>