When using system timers for say inside an event that runs once per day, Should you always call Timer.Dispose() for each timer after the event ends and you have stopped the timers?
Like I said, it couldn't hurt to call Dispose yourself, but you don't have to either, because of GarbageCollector, that .Net has.Quote:
Im using Impluses Base 5165 Source, I have been using Timers in daily events and also for certain Player Quests where things are triggered at certain points or have time limits in them, I mainly started using them so everything was kept tidy and all stuff for each individual thing in 1 place for each given event or quest, There is a Thread that keeps check time wise for things like Buffs ect ect. Would there be any advantage to doing away with the timers and moving the timing part into the Thread mentioned above?
And the reason i asked about dispose was just i had someone looking over some code and when they saw Timer.Stop() said you should also use Timer.Dispose() after it, Which i havent been doing so i was just wondering again if that was the correct way to do it or if he was wrong.
You're better off doing it yourself at some points. Not saying it's necessary in this case, but with streams and such it's highly recommended.Quote:
Yeah, but at some point, it does it anyways. Well not removing memory, but calling finalizers, which are supposed to do the memory freeing.
Ikr? Well if I am correct Impulse source had a lot of deadlock problems as well.Quote:
i am surprised a lot of these servers don't run into concurrency issues, throwing tasks on random threads like that, unless they do!
Deadlocks hardly. Race conditions, not really either. The source I released used one thread per client so they would be fairly rare. Though, a very well known problem would be the collection modified exceptions which is a result of a lack of locks which do exists in most sources.Quote:
You're better off doing it yourself at some points. Not saying it's necessary in this case, but with streams and such it's highly recommended.
Ikr? Well if I am correct Impulse source had a lot of deadlock problems as well.