.net - Best way to disable a System.Threading.Timer -
i have system.threading.timer
toggled on , off. know of 2 methods turn off timer:
- call
timer.change(-1,-1)
- dispose timer, , create new 1 when needed
which 1 better, in terms of resources , performance? calling change(-1,-1)
cpu heater? expensive create timer?
setting timer's initial value , interval -1 (i.e. change(-1, -1)
) not "cpu heater." timers don't use cpu resources. callback method does, of course, during (usually brief) time when it's executing.
in case, not @ expensive create new timer, nor disabling change(-1, -1)
have negative performance consequences. use whichever technique best fits model.
Comments
Post a Comment