.net - Best way to disable a System.Threading.Timer -


i have system.threading.timer toggled on , off. know of 2 methods turn off timer:

  1. call timer.change(-1,-1)
  2. 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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -